Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit 450eec0

Browse files
committed
Search for vboxapi using the root of sys.executable
1 parent c8908ef commit 450eec0

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

docs/source/changelog.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Change log
22
==========
33

4+
master
5+
6+
* Add sys.executable-derived paths in list to check for vboxapi (@SethMichaelLarson PR #69)
7+
* Fix IGuestProcess.execute() on Python 3.x (@SethMichaelLarson PR #58)
8+
* Fix errors to not output on Windows platforms. (@SethMichaelLarson PR #57)
9+
410
version 1.0.0
511

612
* Support for 5.0.x VirtualBox.
@@ -10,7 +16,7 @@ version 1.0.0
1016

1117
version 0.2.2
1218

13-
* Cleanup managers at exiti (reported by @jiml521).
19+
* Cleanup managers at exit (reported by @jiml521).
1420
* Add three time check for attribute in xpcom interface object before failing (reported
1521
by @shohamp).
1622
* Update library.py to 4.3.28/src/VBox/Main/idl/VirtualBox.xidl

virtualbox/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,23 @@ def import_vboxapi():
6565
search = ['/Library/Python/%s.%s/site-packages' % py_mm_ver]
6666
else:
6767
# No idea where to look...
68-
raise
68+
search = []
69+
70+
# Generates a common prefix from sys.executable in the
71+
# case that vboxapi is installed in a virtualenv.
72+
# This will also help with when we don't know where
73+
# to search because of an unknown platform.
74+
# These paths also help if the system Python is installed
75+
# in a non-standard location.
76+
#
77+
# NOTE: We don't have to worry if these directories don't
78+
# exist as they're checked below.
79+
prefix = os.path.dirname(os.path.dirname(sys.executable))
80+
search.extend([os.path.join(prefix, 'Lib', 'site-packages'),
81+
os.path.join(prefix, 'Lib', 'site-packages', 'win32'),
82+
os.path.join(prefix, 'Lib', 'site-packages', 'win32', 'lib'),
83+
os.path.join(prefix, 'lib', 'site-packages'),
84+
os.path.join(prefix, 'lib', 'dist-packages')])
6985

7086
packages = set(packages)
7187
original_path = copy.copy(sys.path)

0 commit comments

Comments
 (0)