Changeset 48282 in vbox for trunk/src/libs/xpcom18a4/python
- Timestamp:
- Sep 4, 2013 11:59:15 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 88697
- Location:
- trunk/src/libs/xpcom18a4/python
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/python/Makefile.kmk
r41477 r48282 27 27 # 28 28 # List of supported Python versions, defining a number of 29 # VBOX_PYTHON[25|26|27| 28|DEF]_[INC|LIB] variables which get picked up below.29 # VBOX_PYTHON[25|26|27|DEF]_[INC|LIB] variables which get picked up below. 30 30 # 31 31 ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script. … … 33 33 VBOX_PYTHON25_INC = $(VBOX_PATH_MACOSX_SDK)/usr/include/python2.5 34 34 VBOX_PYTHON25_LIB = $(VBOX_PATH_MACOSX_SDK)/usr/lib/libpython2.5.dylib 35 VBOX_PYTHON25_LIB_X86 = $(VBOX_PYTHON25_LIB) 35 36 endif 36 37 if !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6) \ … … 39 40 VBOX_PYTHON26_INC = $(VBOX_PATH_MACOSX_SDK_10_6)/usr/include/python2.6 40 41 VBOX_PYTHON26_LIB = $(VBOX_PATH_MACOSX_SDK_10_6)/usr/lib/libpython2.6.dylib 42 VBOX_PYTHON26_LIB_X86 = $(VBOX_PYTHON26_LIB) 41 43 endif 42 44 if !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7) \ … … 45 47 VBOX_PYTHON27_INC = $(VBOX_PATH_MACOSX_SDK_10_7)/usr/include/python2.7 46 48 VBOX_PYTHON27_LIB = $(VBOX_PATH_MACOSX_SDK_10_7)/usr/lib/libpython2.7.dylib 49 VBOX_PYTHON27_LIB_X86 = $(VBOX_PYTHON27_LIB) 47 50 endif 48 51 … … 103 106 $(PATH_STAGE_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL) 104 107 108 # 32-bit base. 109 VBoxPythonBase_x86_TEMPLATE = XPCOM-x86 110 VBoxPythonBase_x86_EXTENDS = VBoxPythonBase 111 VBoxPythonBase_x86_DEFS = MODULE_NAME_SUFFIX=_x86 $(VBoxPythonBase_DEFS) 112 VBoxPythonBase_x86_LIBS = \ 113 $(PATH_STAGE_LIB)/VBoxCOM-x86$(VBOX_SUFF_LIB) \ 114 $(PATH_STAGE_BIN)/VBoxXPCOM-x86$(VBOX_SUFF_DLL) 115 105 116 106 117 ifdef VBOX_PYTHON23_INC … … 114 125 VBoxPython2_3_INCS = $(VBOX_PYTHON23_INC) 115 126 VBoxPython2_3_LIBS = $(VBOX_PYTHON23_LIB) 127 128 ifdef VBOX_WITH_32_ON_64_MAIN_API 129 DLLS += VBoxPython2_3_x86 130 VBoxPython2_3_x86_EXTENDS = VBoxPythonBase_x86 131 VBoxPython2_3_x86_EXTENDS_BY = appending 132 VBoxPython2_3_x86_TEMPLATE = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX104,-x86) 133 VBoxPython2_3_x86_INCS = $(VBOX_PYTHON23_INC) 134 VBoxPython2_3_x86_LIBS = $(VBOX_PYTHON23_LIB_X86) 135 endif 116 136 endif 117 137 … … 125 145 VBoxPython2_4_INCS = $(VBOX_PYTHON24_INC) 126 146 VBoxPython2_4_LIBS = $(VBOX_PYTHON24_LIB) 147 148 ifdef VBOX_WITH_32_ON_64_MAIN_API 149 DLLS += VBoxPython2_4_x86 150 VBoxPython2_4_x86_EXTENDS = VBoxPythonBase_x86 151 VBoxPython2_4_x86_EXTENDS_BY = appending 152 VBoxPython2_4_x86_INCS = $(VBOX_PYTHON24_INC) 153 VBoxPython2_4_x86_LIBS = $(VBOX_PYTHON24_LIB_X86) 154 endif 127 155 endif 128 156 … … 134 162 VBoxPython2_5_EXTENDS = VBoxPythonBase 135 163 VBoxPython2_5_EXTENDS_BY = appending 136 VBoxPython2_5_TEMPLATE = XPCOM137 164 VBoxPython2_5_INCS = $(VBOX_PYTHON25_INC) 138 165 VBoxPython2_5_LIBS = $(VBOX_PYTHON25_LIB) 166 167 ifdef VBOX_WITH_32_ON_64_MAIN_API 168 DLLS += VBoxPython2_5_x86 169 VBoxPython2_5_x86_EXTENDS = VBoxPythonBase_x86 170 VBoxPython2_5_x86_EXTENDS_BY = appending 171 VBoxPython2_5_x86_INCS = $(VBOX_PYTHON25_INC) 172 VBoxPython2_5_x86_LIBS = $(VBOX_PYTHON25_LIB_X86) 173 endif 139 174 endif 140 175 … … 149 184 VBoxPython2_6_INCS = $(VBOX_PYTHON26_INC) 150 185 VBoxPython2_6_LIBS = $(VBOX_PYTHON26_LIB) 186 187 ifdef VBOX_WITH_32_ON_64_MAIN_API 188 DLLS += VBoxPython2_6_x86 189 VBoxPython2_6_x86_EXTENDS = VBoxPythonBase_x86 190 VBoxPython2_6_x86_EXTENDS_BY = appending 191 VBoxPython2_6_x86_TEMPLATE = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX106,-x86) 192 VBoxPython2_6_x86_INCS = $(VBOX_PYTHON26_INC) 193 VBoxPython2_6_x86_LIBS = $(VBOX_PYTHON26_LIB_X86) 194 endif 151 195 endif 152 196 … … 160 204 VBoxPython2_7_TEMPLATE = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX107,) 161 205 VBoxPython2_7_INCS = $(VBOX_PYTHON27_INC) 162 VBoxPython2_7_LIBS = $(VBOX_PYTHON27_LIB) 163 endif 164 165 ifdef VBOX_PYTHON28_INC 166 # 167 # Python 2.8 version 168 # 169 DLLS += VBoxPython2_8 170 VBoxPython2_8_EXTENDS = VBoxPythonBase 171 VBoxPython2_8_EXTENDS_BY = appending 172 VBoxPython2_8_INCS = $(VBOX_PYTHON28_INC) 173 VBoxPython2_8_LIBS = $(VBOX_PYTHON28_LIB) 206 VBoxPython2_7_LIBS = $(VBOX_PYTHON27_LIB_X86) 207 208 ifdef VBOX_WITH_32_ON_64_MAIN_API 209 DLLS += VBoxPython2_7_x86 210 VBoxPython2_7_x86_EXTENDS = VBoxPythonBase_x86 211 VBoxPython2_7_x86_EXTENDS_BY = appending 212 VBoxPython2_7_x86_TEMPLATE = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX107,-x86) 213 VBoxPython2_7_x86_INCS = $(VBOX_PYTHON27_INC) 214 VBoxPython2_7_x86_LIBS = $(VBOX_PYTHON27_LIB_X86) 215 endif 174 216 endif 175 217 … … 187 229 VBoxPython_LIBS = $(VBoxPythonBase_LIBS) $(VBOX_PYTHONDEF_LIB) 188 230 endif 231 232 ifdef VBOX_WITH_32_ON_64_MAIN_API 233 VBoxPython_x86_EXTENDS = VBoxPythonBase_x86 234 VBoxPython_x86_DEFS = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_x86_DEFS)) 235 VBoxPython_x86_INCS = $(VBoxPythonBase_x86_INCS) $(VBOX_PYTHONDEF_INC) 236 if "$(KBUILD_TARGET)" == "linux" 237 VBoxPython_x86_LIBS = $(VBoxPythonBase_x86_LIBS) 238 else 239 VBoxPython_x86_LIBS = $(VBoxPythonBase_x86_LIBS) $(VBOX_PYTHONDEF_LIB_X86) 240 endif 241 endif 189 242 endif 190 243 -
trunk/src/libs/xpcom18a4/python/gen_python_deps.py
r46230 r48282 15 15 import os,sys 16 16 17 versions = ["2.3", "2.4", "2.5", "2.6", "2.7", "2.8"]17 versions = ["2.3", "2.4", "2.5", "2.6", "2.7",] 18 18 prefixes = ["/usr", "/usr/local", "/opt", "/opt/local"] 19 19 known = {} … … 44 44 if bitness_magic > 0: 45 45 print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[2], sep) 46 print "VBOX_PYTHON%s_LIB_X86=%s%s" %(vers, known[1], sep) 46 47 else: 47 48 print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[1], sep) -
trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp
r46649 r48282 75 75 76 76 #ifdef VBOX_PYXPCOM 77 # include <iprt/cdefs.h> 78 # ifndef MODULE_NAME_SUFFIX 79 # define MANGLE_MODULE_NAME(a_szName) a_szName 80 # define MANGLE_MODULE_INIT(a_Name) a_Name 81 # else 82 # define MANGLE_MODULE_NAME(a_szName) a_szName RT_XSTR(MODULE_NAME_SUFFIX) 83 # define MANGLE_MODULE_INIT(a_Name) RT_CONCAT(a_Name, MODULE_NAME_SUFFIX) 84 # endif 77 85 # ifdef VBOX_PYXPCOM_VERSIONED 78 86 # if PY_VERSION_HEX >= 0x02080000 79 # define MODULE_NAME "VBoxPython2_8" 87 # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython2_8") 88 # define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_8) 89 80 90 # elif PY_VERSION_HEX >= 0x02070000 81 # define MODULE_NAME "VBoxPython2_7" 91 # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython2_7") 92 # define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_7) 93 82 94 # elif PY_VERSION_HEX >= 0x02060000 83 # define MODULE_NAME "VBoxPython2_6" 95 # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython2_6") 96 # define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_6) 97 84 98 # elif PY_VERSION_HEX >= 0x02050000 85 # define MODULE_NAME "VBoxPython2_5" 99 # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython2_5") 100 # define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_5) 101 86 102 # elif PY_VERSION_HEX >= 0x02040000 87 # define MODULE_NAME "VBoxPython2_4" 103 # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython2_4") 104 # define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_4) 105 88 106 # elif PY_VERSION_HEX >= 0x02030000 89 # define MODULE_NAME "VBoxPython2_3" 107 # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython2_3") 108 # define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_3) 90 109 # else 91 110 # error "Fix module versioning." 92 111 # endif 93 112 # else 94 # define MODULE_NAME "VBoxPython" 113 # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython") 114 # define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython) 95 115 # endif 96 116 #else … … 777 797 extern "C" NS_EXPORT 778 798 void 779 # ifdef VBOX_PYXPCOM_VERSIONED 780 # if PY_VERSION_HEX >= 0x02080000 781 initVBoxPython2_8() { 782 # elif PY_VERSION_HEX >= 0x02070000 783 initVBoxPython2_7() { 784 # elif PY_VERSION_HEX >= 0x02060000 785 initVBoxPython2_6() { 786 # elif PY_VERSION_HEX >= 0x02050000 787 initVBoxPython2_5() { 788 # elif PY_VERSION_HEX >= 0x02040000 789 initVBoxPython2_4() { 790 # elif PY_VERSION_HEX >= 0x02030000 791 initVBoxPython2_3() { 792 # else 793 # error "Fix module versioning." 794 # endif 795 # else 796 initVBoxPython() { 797 # endif 799 initVBoxPython() { /* NOTE! This name is redefined at the top of the file! */ 798 800 static bool s_vboxInited = false; 799 801 if (!s_vboxInited) { -
trunk/src/libs/xpcom18a4/python/vboxxpcom.py
r44529 r48282 15 15 import platform 16 16 17 # this code overcomes somewhat unlucky feature of Python, where it searches 17 # 18 # This code overcomes somewhat unlucky feature of Python, where it searches 18 19 # for binaries in the same place as platfom independent modules, while 19 20 # rest of Python bindings expect _xpcom to be inside xpcom module 21 # 20 22 21 candidates = ['VBoxPython' + str(sys.version_info[0]) + '_' + str(sys.version_info[1]), 22 'VBoxPython' + str(sys.version_info[0]), 23 'VBoxPython'] 23 _asVBoxPythons = [ 24 'VBoxPython' + str(sys.version_info[0]) + '_' + str(sys.version_info[1]), 25 'VBoxPython' + str(sys.version_info[0]), 26 'VBoxPython' 27 ]; 28 29 # On platforms where we ship both 32-bit and 64-bit API bindings, we have to 30 # look for the right set if we're a 32-bit process. 31 if platform.system() in [ 'SunOS', ] and sys.maxsize <= 2**32: 32 _asNew = [ sCandidate + '_x86' for sCandidate in _asVBoxPythons ]; 33 _asNew.extend(_asVBoxPythons); 34 _asVBoxPythons = _asNew; 35 del _asNew; 36 37 # On Darwin (aka Mac OS X) we know exactly where things are in a normal 38 # VirtualBox installation. 39 ## @todo Edit this at build time to the actual VBox location set in the make files. 40 ## @todo We know the location for most hardened builds, not just darwin! 24 41 if platform.system() == 'Darwin': 25 # On Darwin (aka Mac OS X) we know exactly where things are in a normal26 # VirtualBox installation. Also, there are two versions of python there27 # (2.3.x and 2.5.x) depending on whether the os is striped or spotty, so28 # we have to choose the right module to load.29 #30 # XXX: This needs to be adjusted for OSE builds. A more general solution would31 # be to to sed the file during install and inject the VBOX_PATH_APP_PRIVATE_ARCH32 # and VBOX_PATH_SHARED_LIBS when these are set.33 42 sys.path.append('/Applications/VirtualBox.app/Contents/MacOS') 34 43 35 cglue = None 36 for m in candidates: 37 try: 38 cglue = __import__(m) 39 break 40 except: 41 pass 44 _oVBoxPythonMod = None 45 for m in _asVBoxPythons: 46 try: 47 _oVBoxPythonMod = __import__(m) 48 break 49 except Exception, x: 50 print 'm=%s x=%s' % (m, x); 51 #except: 52 # pass 42 53 43 54 if platform.system() == 'Darwin': 44 55 sys.path.remove('/Applications/VirtualBox.app/Contents/MacOS') 45 56 46 if cglue== None:47 raise Exception , "Cannot find VBoxPython module"57 if _oVBoxPythonMod == None: 58 raise Exception('Cannot find VBoxPython module (tried: %s)' % (', '.join(_asVBoxPythons),)); 48 59 49 sys.modules['xpcom._xpcom'] = cglue50 xpcom._xpcom = cglue60 sys.modules['xpcom._xpcom'] = _oVBoxPythonMod; 61 xpcom._xpcom = _oVBoxPythonMod; 51 62
Note:
See TracChangeset
for help on using the changeset viewer.