1 | #
|
---|
2 | # Copyright (C) 2008 Sun Microsystems, Inc.
|
---|
3 | #
|
---|
4 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
5 | # available from http://www.virtualbox.org. This file is free software;
|
---|
6 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
7 | # General Public License (GPL) as published by the Free Software
|
---|
8 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
9 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
10 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
11 | #
|
---|
12 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
13 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
14 | # additional information or have any questions.
|
---|
15 | #
|
---|
16 |
|
---|
17 | import xpcom
|
---|
18 | import sys
|
---|
19 | import platform
|
---|
20 |
|
---|
21 | # this code overcomes somewhat unlucky feature of Python, where it searches
|
---|
22 | # for binaries in the same place as platfom independent modules, while
|
---|
23 | # rest of Python bindings expect _xpcom to be inside xpcom module
|
---|
24 | # XXX: maybe implement per Python version module search
|
---|
25 | #cglue = __import__('VBoxPython')
|
---|
26 | if platform.system() == 'Darwin':
|
---|
27 | # TODO: This needs to be changed if it is supposed to work with OSE as well.
|
---|
28 | saved_sys_path = sys.path;
|
---|
29 | sys.path = [ '/Applications/VirtualBox.app/Contents/MacOS', ] + saved_sys_path
|
---|
30 | cglue = __import__('VBoxPython')
|
---|
31 | sys.path = saved_sys_path
|
---|
32 | else:
|
---|
33 | cglue = __import__('VBoxPython')
|
---|
34 | sys.modules['xpcom._xpcom'] = cglue
|
---|
35 | xpcom._xpcom = cglue
|
---|