Changeset 103325 in vbox for trunk/src/VBox/Installer/common
- Timestamp:
- Feb 13, 2024 12:40:49 AM (11 months ago)
- Location:
- trunk/src/VBox/Installer/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/common/vboxapisetup-stub.py
r103028 r103325 37 37 import sys 38 38 try: 39 sys.path.append("vboxapi") 39 sys.path.append("vboxapi") # ASSUMES that the CWD is the same as the script directory. This has always been the case. 40 40 import setup 41 41 sys.exit(setup.main()) 42 except ImportError as exc:43 print("VBox Python API binding sources not found: %s" % ( exc))42 except ImportError as oXcpt: 43 print("VBox Python API binding sources not found: %s" % (oXcpt,)) 44 44 sys.exit(1) -
trunk/src/VBox/Installer/common/vboxapisetup.py
r103073 r103325 136 136 oVBox = oVBoxMgr.getVirtualBox() 137 137 oHost = oVBox.host 138 if oHost.architecture not in (oVBoxMgr.constants.PlatformArchitecture_x86, \138 if oHost.architecture not in (oVBoxMgr.constants.PlatformArchitecture_x86, 139 139 oVBoxMgr.constants.PlatformArchitecture_ARM): 140 140 raise Exception('Host platform invalid!') … … 144 144 del oVBoxMgr 145 145 except ImportError as exc: 146 print("ERROR: Testing VirtualBox Python bindings failed: %s" % (exc ))146 print("ERROR: Testing VirtualBox Python bindings failed: %s" % (exc,)) 147 147 return False 148 148 149 print("Installation of VirtualBox Python bindings for Python %d.%d successful." \149 print("Installation of VirtualBox Python bindings for Python %d.%d successful." 150 150 % (sys.version_info.major, sys.version_info.minor)) 151 151 return True 152 152 153 def findModulePathHelper(sModule = 'vboxapi', a Dir = sys.path):153 def findModulePathHelper(sModule = 'vboxapi', asDirs = None): 154 154 """ 155 155 Helper function for findModulePath. … … 157 157 Returns the path found, or None if not found. 158 158 """ 159 for sPath in aDir: 159 if asDirs is None: 160 asDirs = sys.path; 161 for sPath in asDirs: 160 162 if g_fVerbose: 161 163 print('Searching for "%s" in path "%s" ...' % (sModule, sPath)) 164 ## @todo r=bird: WOW. We read the directory and then look for a filename in the returned list?!? Case sensitively. 165 ## What about: 166 ## if g_fVerbose: # drop this 167 ## print(os.listdir(sPath)); 168 ## sCandiate = os.path.join(sPath, sModule); 169 ## if os.path.exists(sCandiate): 170 ## return sCandiate; 162 171 if os.path.isdir(sPath): 163 a DirEntries = os.listdir(sPath)172 asDirEntries = os.listdir(sPath) 164 173 if g_fVerbose: 165 print(a DirEntries)166 if sModule in a DirEntries:174 print(asDirEntries) 175 if sModule in asDirEntries: 167 176 return os.path.join(sPath, sModule) 168 177 return None … … 188 197 pass 189 198 190 class setupInstallClass(install):199 class VBoxSetupInstallClass(install): 191 200 """ 192 201 Class which overrides the "install" command of the setup so that we can … … 210 219 # Deprecation warning for older Python stuff (< Python 3.x). 211 220 if sys.version_info.major < 3: 212 print("\nWarning: Running VirtualBox with Python %d.%d is marked as being deprecated.\n" \213 "Please upgrade your Python installation to avoid breakage.\n" \214 % (sys.version_info.major, sys.version_info.minor ))221 print("\nWarning: Running VirtualBox with Python %d.%d is marked as being deprecated.\n" 222 "Please upgrade your Python installation to avoid breakage.\n" 223 % (sys.version_info.major, sys.version_info.minor,)) 215 224 216 225 sVBoxInstallPath = os.environ.get("VBOX_MSI_INSTALL_PATH", None) … … 247 256 # Better would be patching the *installed* module instead of the original module. 248 257 sVBoxSdkPath = os.path.join(sVBoxInstallPath, "sdk") 249 fRc = patchWith(os.path.join(sCurDir, 'src', 'vboxapi', '__init__.py'), \ 250 sVBoxInstallPath, sVBoxSdkPath) 258 fRc = patchWith(os.path.join(sCurDir, 'src', 'vboxapi', '__init__.py'), sVBoxInstallPath, sVBoxSdkPath) 251 259 if not fRc: 252 260 return 1 … … 266 274 print("ERROR: setuptools package not installed, can't continue. Exiting.") 267 275 return 1 268 setup(cmdclass ={"install": setupInstallClass})276 setup(cmdclass = { "install": VBoxSetupInstallClass, }) 269 277 else: 270 278 try: … … 279 287 print("Invoking setuptools directly ...") 280 288 setupTool = setup(name='vboxapi', 281 version=sVBoxVersion,282 description='Python interface to VirtualBox',283 author='Oracle Corp.',284 author_email='[email protected]',285 url='https://www.virtualbox.org',286 package_dir={'': 'src'},287 packages=['vboxapi'])289 version=sVBoxVersion, 290 description='Python interface to VirtualBox', 291 author='Oracle Corp.', 292 author_email='[email protected]', 293 url='https://www.virtualbox.org', 294 package_dir={'': 'src'}, 295 packages=['vboxapi']) 288 296 if setupTool: 289 297 sPathInstalled = setupTool.command_obj['install'].install_lib 290 298 if sPathInstalled not in sys.path: 291 print("\nWARNING: Installation path is not in current module search path!") 292 print(" This might happen on OSes / distributions which only maintain packages by") 293 print(" a vendor-specific method.") 299 print(""); 300 print("WARNING: Installation path is not in current module search path!") 301 print(" This might happen on OSes / distributions which only maintain ") 302 print(" packages by a vendor-specific method.") 294 303 print("Hints:") 295 304 print("- Check how the distribution handles user-installable Python packages.") … … 304 313 305 314 except RuntimeError as exc: 306 print("ERROR: Installation of VirtualBox Python bindings failed: %s" % (exc ))315 print("ERROR: Installation of VirtualBox Python bindings failed: %s" % (exc,)) 307 316 return 1 308 317
Note:
See TracChangeset
for help on using the changeset viewer.