VirtualBox

Changeset 48282 in vbox for trunk/src/libs/xpcom18a4/python


Ignore:
Timestamp:
Sep 4, 2013 11:59:15 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88697
Message:

32-bit main API on 64-bit solaris.

Location:
trunk/src/libs/xpcom18a4/python
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/python/Makefile.kmk

    r41477 r48282  
    2727#
    2828# 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.
    3030#
    3131ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script.
     
    3333  VBOX_PYTHON25_INC = $(VBOX_PATH_MACOSX_SDK)/usr/include/python2.5
    3434  VBOX_PYTHON25_LIB = $(VBOX_PATH_MACOSX_SDK)/usr/lib/libpython2.5.dylib
     35  VBOX_PYTHON25_LIB_X86 = $(VBOX_PYTHON25_LIB)
    3536 endif
    3637 if  !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6) \
     
    3940  VBOX_PYTHON26_INC = $(VBOX_PATH_MACOSX_SDK_10_6)/usr/include/python2.6
    4041  VBOX_PYTHON26_LIB = $(VBOX_PATH_MACOSX_SDK_10_6)/usr/lib/libpython2.6.dylib
     42  VBOX_PYTHON26_LIB_X86 = $(VBOX_PYTHON26_LIB)
    4143 endif
    4244 if  !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7) \
     
    4547  VBOX_PYTHON27_INC = $(VBOX_PATH_MACOSX_SDK_10_7)/usr/include/python2.7
    4648  VBOX_PYTHON27_LIB = $(VBOX_PATH_MACOSX_SDK_10_7)/usr/lib/libpython2.7.dylib
     49  VBOX_PYTHON27_LIB_X86 = $(VBOX_PYTHON27_LIB)
    4750 endif
    4851
     
    103106        $(PATH_STAGE_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
    104107
     108# 32-bit base.
     109VBoxPythonBase_x86_TEMPLATE = XPCOM-x86
     110VBoxPythonBase_x86_EXTENDS  = VBoxPythonBase
     111VBoxPythonBase_x86_DEFS     = MODULE_NAME_SUFFIX=_x86 $(VBoxPythonBase_DEFS)
     112VBoxPythonBase_x86_LIBS     = \
     113        $(PATH_STAGE_LIB)/VBoxCOM-x86$(VBOX_SUFF_LIB) \
     114        $(PATH_STAGE_BIN)/VBoxXPCOM-x86$(VBOX_SUFF_DLL)
     115
    105116
    106117ifdef VBOX_PYTHON23_INC
     
    114125VBoxPython2_3_INCS       = $(VBOX_PYTHON23_INC)
    115126VBoxPython2_3_LIBS       = $(VBOX_PYTHON23_LIB)
     127
     128 ifdef VBOX_WITH_32_ON_64_MAIN_API
     129DLLS += VBoxPython2_3_x86
     130VBoxPython2_3_x86_EXTENDS    = VBoxPythonBase_x86
     131VBoxPython2_3_x86_EXTENDS_BY = appending
     132VBoxPython2_3_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX104,-x86)
     133VBoxPython2_3_x86_INCS       = $(VBOX_PYTHON23_INC)
     134VBoxPython2_3_x86_LIBS       = $(VBOX_PYTHON23_LIB_X86)
     135 endif
    116136endif
    117137
     
    125145VBoxPython2_4_INCS       = $(VBOX_PYTHON24_INC)
    126146VBoxPython2_4_LIBS       = $(VBOX_PYTHON24_LIB)
     147
     148 ifdef VBOX_WITH_32_ON_64_MAIN_API
     149DLLS += VBoxPython2_4_x86
     150VBoxPython2_4_x86_EXTENDS    = VBoxPythonBase_x86
     151VBoxPython2_4_x86_EXTENDS_BY = appending
     152VBoxPython2_4_x86_INCS       = $(VBOX_PYTHON24_INC)
     153VBoxPython2_4_x86_LIBS       = $(VBOX_PYTHON24_LIB_X86)
     154 endif
    127155endif
    128156
     
    134162VBoxPython2_5_EXTENDS    = VBoxPythonBase
    135163VBoxPython2_5_EXTENDS_BY = appending
    136 VBoxPython2_5_TEMPLATE   = XPCOM
    137164VBoxPython2_5_INCS       = $(VBOX_PYTHON25_INC)
    138165VBoxPython2_5_LIBS       = $(VBOX_PYTHON25_LIB)
     166
     167 ifdef VBOX_WITH_32_ON_64_MAIN_API
     168DLLS += VBoxPython2_5_x86
     169VBoxPython2_5_x86_EXTENDS    = VBoxPythonBase_x86
     170VBoxPython2_5_x86_EXTENDS_BY = appending
     171VBoxPython2_5_x86_INCS       = $(VBOX_PYTHON25_INC)
     172VBoxPython2_5_x86_LIBS       = $(VBOX_PYTHON25_LIB_X86)
     173 endif
    139174endif
    140175
     
    149184VBoxPython2_6_INCS       = $(VBOX_PYTHON26_INC)
    150185VBoxPython2_6_LIBS       = $(VBOX_PYTHON26_LIB)
     186
     187 ifdef VBOX_WITH_32_ON_64_MAIN_API
     188DLLS += VBoxPython2_6_x86
     189VBoxPython2_6_x86_EXTENDS    = VBoxPythonBase_x86
     190VBoxPython2_6_x86_EXTENDS_BY = appending
     191VBoxPython2_6_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX106,-x86)
     192VBoxPython2_6_x86_INCS       = $(VBOX_PYTHON26_INC)
     193VBoxPython2_6_x86_LIBS       = $(VBOX_PYTHON26_LIB_X86)
     194 endif
    151195endif
    152196
     
    160204VBoxPython2_7_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX107,)
    161205VBoxPython2_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)
     206VBoxPython2_7_LIBS       = $(VBOX_PYTHON27_LIB_X86)
     207
     208 ifdef VBOX_WITH_32_ON_64_MAIN_API
     209DLLS += VBoxPython2_7_x86
     210VBoxPython2_7_x86_EXTENDS    = VBoxPythonBase_x86
     211VBoxPython2_7_x86_EXTENDS_BY = appending
     212VBoxPython2_7_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX107,-x86)
     213VBoxPython2_7_x86_INCS       = $(VBOX_PYTHON27_INC)
     214VBoxPython2_7_x86_LIBS       = $(VBOX_PYTHON27_LIB_X86)
     215 endif
    174216endif
    175217
     
    187229 VBoxPython_LIBS        = $(VBoxPythonBase_LIBS) $(VBOX_PYTHONDEF_LIB)
    188230endif
     231
     232 ifdef VBOX_WITH_32_ON_64_MAIN_API
     233VBoxPython_x86_EXTENDS      = VBoxPythonBase_x86
     234VBoxPython_x86_DEFS         = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_x86_DEFS))
     235VBoxPython_x86_INCS         = $(VBoxPythonBase_x86_INCS) $(VBOX_PYTHONDEF_INC)
     236if "$(KBUILD_TARGET)" == "linux"
     237 VBoxPython_x86_LIBS        = $(VBoxPythonBase_x86_LIBS)
     238else
     239 VBoxPython_x86_LIBS        = $(VBoxPythonBase_x86_LIBS) $(VBOX_PYTHONDEF_LIB_X86)
     240endif
     241 endif
    189242endif
    190243
  • trunk/src/libs/xpcom18a4/python/gen_python_deps.py

    r46230 r48282  
    1515import os,sys
    1616
    17 versions = ["2.3", "2.4", "2.5", "2.6", "2.7", "2.8"]
     17versions = ["2.3", "2.4", "2.5", "2.6", "2.7",]
    1818prefixes = ["/usr", "/usr/local", "/opt", "/opt/local"]
    1919known = {}
     
    4444    if bitness_magic > 0:
    4545        print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[2], sep)
     46        print "VBOX_PYTHON%s_LIB_X86=%s%s" %(vers, known[1], sep)
    4647    else:
    4748        print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[1], sep)
  • trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp

    r46649 r48282  
    7575
    7676#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
    7785# ifdef VBOX_PYXPCOM_VERSIONED
    7886#  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
    8090#  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
    8294#  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
    8498#  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
    86102#  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
    88106#  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)
    90109#  else
    91110#   error "Fix module versioning."
    92111#  endif
    93112# else
    94 #  define MODULE_NAME "VBoxPython"
     113#  define MODULE_NAME     MANGLE_MODULE_NAME("VBoxPython")
     114#  define initVBoxPython  MANGLE_MODULE_INIT(initVBoxPython)
    95115# endif
    96116#else
     
    777797extern "C" NS_EXPORT
    778798void
    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
     799initVBoxPython() { /* NOTE! This name is redefined at the top of the file! */
    798800  static bool s_vboxInited = false;
    799801  if (!s_vboxInited) {
  • trunk/src/libs/xpcom18a4/python/vboxxpcom.py

    r44529 r48282  
    1515import platform
    1616
    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
    1819# for binaries in the same place as platfom independent modules, while
    1920# rest of Python bindings expect _xpcom to be inside xpcom module
     21#
    2022
    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.
     31if 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!
    2441if platform.system() == 'Darwin':
    25     # On Darwin (aka Mac OS X) we know exactly where things are in a normal
    26     # VirtualBox installation. Also, there are two versions of python there
    27     # (2.3.x and 2.5.x) depending on whether the os is striped or spotty, so
    28     # we have to choose the right module to load.
    29     #
    30     # XXX: This needs to be adjusted for OSE builds. A more general solution would
    31     #      be to to sed the file during install and inject the VBOX_PATH_APP_PRIVATE_ARCH
    32     #      and VBOX_PATH_SHARED_LIBS when these are set.
    3342    sys.path.append('/Applications/VirtualBox.app/Contents/MacOS')
    3443
    35 cglue = None
    36 for m in candidates:
    37    try:
    38       cglue =  __import__(m)
    39       break
    40    except:
    41       pass
     44_oVBoxPythonMod = None
     45for 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
    4253
    4354if platform.system() == 'Darwin':
    4455    sys.path.remove('/Applications/VirtualBox.app/Contents/MacOS')
    4556
    46 if cglue == None:
    47     raise Exception, "Cannot find VBoxPython module"
     57if _oVBoxPythonMod == None:
     58    raise Exception('Cannot find VBoxPython module (tried: %s)' % (', '.join(_asVBoxPythons),));
    4859
    49 sys.modules['xpcom._xpcom'] = cglue
    50 xpcom._xpcom = cglue
     60sys.modules['xpcom._xpcom'] = _oVBoxPythonMod;
     61xpcom._xpcom = _oVBoxPythonMod;
    5162
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette