VirtualBox

Changeset 63775 in vbox for trunk/src/libs


Ignore:
Timestamp:
Sep 9, 2016 9:54:19 AM (8 years ago)
Author:
vboxsync
Message:

PyXPCOM: make it aware of the apiflags part of the library name (and use it ourselves), because it gets used since Python 3.2, and most libraries these days have the "m" flag, indicating that pymalloc is enabled

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

Legend:

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

    r60975 r63775  
    2727#
    2828# List of supported Python versions, defining a number of
    29 # VBOX_PYTHON[26|27|31|32|33|34|35|DEF]_[INC|LIB] variables
     29# VBOX_PYTHON[26|27|31|32|32M|33|33M|34|34M|35|35M|DEF]_[INC|LIB] variables
    3030# which get picked up below.
    3131#
     
    146146
    147147 ifdef VBOX_WITH_32_ON_64_MAIN_API
     148  ifdef VBOX_PYTHON26_LIB_X86
    148149DLLS += VBoxPython2_6_x86
    149150VBoxPython2_6_x86_EXTENDS    = VBoxPythonBase_x86
     
    152153VBoxPython2_6_x86_INCS       = $(VBOX_PYTHON26_INC)
    153154VBoxPython2_6_x86_LIBS       = $(VBOX_PYTHON26_LIB_X86)
     155  endif
    154156 endif
    155157endif
     
    167169
    168170 ifdef VBOX_WITH_32_ON_64_MAIN_API
     171  ifdef VBOX_PYTHON27_LIB_X86
    169172DLLS += VBoxPython2_7_x86
    170173VBoxPython2_7_x86_EXTENDS    = VBoxPythonBase_x86
     
    173176VBoxPython2_7_x86_INCS       = $(VBOX_PYTHON27_INC)
    174177VBoxPython2_7_x86_LIBS       = $(VBOX_PYTHON27_LIB_X86)
     178  endif
    175179 endif
    176180endif
     
    188192
    189193 ifdef VBOX_WITH_32_ON_64_MAIN_API
     194  ifdef VBOX_PYTHON31_LIB_X86
    190195DLLS += VBoxPython3_1_x86
    191196VBoxPython3_1_x86_EXTENDS    = VBoxPythonBase_x86
     
    194199VBoxPython3_1_x86_INCS       = $(VBOX_PYTHON31_INC)
    195200VBoxPython3_1_x86_LIBS       = $(VBOX_PYTHON31_LIB_X86)
     201  endif
    196202 endif
    197203endif
     
    209215
    210216 ifdef VBOX_WITH_32_ON_64_MAIN_API
     217  ifdef VBOX_PYTHON32_LIB_X86
    211218DLLS += VBoxPython3_2_x86
    212219VBoxPython3_2_x86_EXTENDS    = VBoxPythonBase_x86
     
    215222VBoxPython3_2_x86_INCS       = $(VBOX_PYTHON32_INC)
    216223VBoxPython3_2_x86_LIBS       = $(VBOX_PYTHON32_LIB_X86)
     224  endif
     225 endif
     226endif
     227
     228ifdef VBOX_PYTHON32M_INC
     229#
     230# Python 3.2 version with pymalloc
     231#
     232DLLS += VBoxPython3_2m
     233VBoxPython3_2m_EXTENDS    = VBoxPythonBase
     234VBoxPython3_2m_EXTENDS_BY = appending
     235VBoxPython3_2m_TEMPLATE   = XPCOM
     236VBoxPython3_2m_INCS       = $(VBOX_PYTHON32M_INC)
     237VBoxPython3_2m_LIBS       = $(VBOX_PYTHON32M_LIB)
     238
     239 ifdef VBOX_WITH_32_ON_64_MAIN_API
     240  ifdef VBOX_PYTHON32M_LIB_X86
     241DLLS += VBoxPython3_2m_x86
     242VBoxPython3_2m_x86_EXTENDS    = VBoxPythonBase_x86
     243VBoxPython3_2m_x86_EXTENDS_BY = appending
     244VBoxPython3_2m_x86_TEMPLATE   = XPCOM
     245VBoxPython3_2m_x86_INCS       = $(VBOX_PYTHON32M_INC)
     246VBoxPython3_2m_x86_LIBS       = $(VBOX_PYTHON32M_LIB_X86)
     247  endif
    217248 endif
    218249endif
     
    230261
    231262 ifdef VBOX_WITH_32_ON_64_MAIN_API
     263  ifdef VBOX_PYTHON33_LIB_X86
    232264DLLS += VBoxPython3_3_x86
    233265VBoxPython3_3_x86_EXTENDS    = VBoxPythonBase_x86
     
    236268VBoxPython3_3_x86_INCS       = $(VBOX_PYTHON33_INC)
    237269VBoxPython3_3_x86_LIBS       = $(VBOX_PYTHON33_LIB_X86)
     270  endif
     271 endif
     272endif
     273
     274ifdef VBOX_PYTHON33M_INC
     275#
     276# Python 3.3 version with pymalloc
     277#
     278DLLS += VBoxPython3_3m
     279VBoxPython3_3m_EXTENDS    = VBoxPythonBase
     280VBoxPython3_3m_EXTENDS_BY = appending
     281VBoxPython3_3m_TEMPLATE   = XPCOM
     282VBoxPython3_3m_INCS       = $(VBOX_PYTHON33M_INC)
     283VBoxPython3_3m_LIBS       = $(VBOX_PYTHON33M_LIB)
     284
     285 ifdef VBOX_WITH_32_ON_64_MAIN_API
     286  ifdef VBOX_PYTHON33M_LIB_X86
     287DLLS += VBoxPython3_3m_x86
     288VBoxPython3_3m_x86_EXTENDS    = VBoxPythonBase_x86
     289VBoxPython3_3m_x86_EXTENDS_BY = appending
     290VBoxPython3_3m_x86_TEMPLATE   = XPCOM
     291VBoxPython3_3m_x86_INCS       = $(VBOX_PYTHON33M_INC)
     292VBoxPython3_3m_x86_LIBS       = $(VBOX_PYTHON33M_LIB_X86)
     293  endif
    238294 endif
    239295endif
     
    251307
    252308 ifdef VBOX_WITH_32_ON_64_MAIN_API
     309  ifdef VBOX_PYTHON34_LIB_X86
    253310DLLS += VBoxPython3_4_x86
    254311VBoxPython3_4_x86_EXTENDS    = VBoxPythonBase_x86
     
    257314VBoxPython3_4_x86_INCS       = $(VBOX_PYTHON34_INC)
    258315VBoxPython3_4_x86_LIBS       = $(VBOX_PYTHON34_LIB_X86)
     316  endif
     317 endif
     318endif
     319
     320ifdef VBOX_PYTHON34M_INC
     321#
     322# Python 3.4 version with pymalloc
     323#
     324DLLS += VBoxPython3_4m
     325VBoxPython3_4m_EXTENDS    = VBoxPythonBase
     326VBoxPython3_4m_EXTENDS_BY = appending
     327VBoxPython3_4m_TEMPLATE   = XPCOM
     328VBoxPython3_4m_INCS       = $(VBOX_PYTHON34M_INC)
     329VBoxPython3_4m_LIBS       = $(VBOX_PYTHON34M_LIB)
     330
     331 ifdef VBOX_WITH_32_ON_64_MAIN_API
     332  ifdef VBOX_PYTHON34M_LIB_X86
     333DLLS += VBoxPython3_4m_x86
     334VBoxPython3_4m_x86_EXTENDS    = VBoxPythonBase_x86
     335VBoxPython3_4m_x86_EXTENDS_BY = appending
     336VBoxPython3_4m_x86_TEMPLATE   = XPCOM
     337VBoxPython3_4m_x86_INCS       = $(VBOX_PYTHON34M_INC)
     338VBoxPython3_4m_x86_LIBS       = $(VBOX_PYTHON34M_LIB_X86)
     339  endif
    259340 endif
    260341endif
     
    272353
    273354 ifdef VBOX_WITH_32_ON_64_MAIN_API
     355  ifdef VBOX_PYTHON35_LIB_X86
    274356DLLS += VBoxPython3_5_x86
    275357VBoxPython3_5_x86_EXTENDS    = VBoxPythonBase_x86
     
    278360VBoxPython3_5_x86_INCS       = $(VBOX_PYTHON35_INC)
    279361VBoxPython3_5_x86_LIBS       = $(VBOX_PYTHON35_LIB_X86)
     362  endif
     363 endif
     364endif
     365
     366ifdef VBOX_PYTHON35M_INC
     367#
     368# Python 3.5 version with pymalloc
     369#
     370DLLS += VBoxPython3_5m
     371VBoxPython3_5m_EXTENDS    = VBoxPythonBase
     372VBoxPython3_5m_EXTENDS_BY = appending
     373VBoxPython3_5m_TEMPLATE   = XPCOM
     374VBoxPython3_5m_INCS       = $(VBOX_PYTHON35M_INC)
     375VBoxPython3_5m_LIBS       = $(VBOX_PYTHON35M_LIB)
     376
     377 ifdef VBOX_WITH_32_ON_64_MAIN_API
     378  ifdef VBOX_PYTHON35M_LIB_X86
     379DLLS += VBoxPython3_5m_x86
     380VBoxPython3_5m_x86_EXTENDS    = VBoxPythonBase_x86
     381VBoxPython3_5m_x86_EXTENDS_BY = appending
     382VBoxPython3_5m_x86_TEMPLATE   = XPCOM
     383VBoxPython3_5m_x86_INCS       = $(VBOX_PYTHON35M_INC)
     384VBoxPython3_5m_x86_LIBS       = $(VBOX_PYTHON35M_LIB_X86)
     385  endif
    280386 endif
    281387endif
     
    296402
    297403 ifdef VBOX_WITH_32_ON_64_MAIN_API
     404  ifdef VBOX_PYTHONDEF_LIB_X86
    298405VBoxPython_x86_EXTENDS      = VBoxPythonBase_x86
    299406VBoxPython_x86_DEFS         = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_x86_DEFS))
     
    304411 VBoxPython_x86_LIBS        = $(VBoxPythonBase_x86_LIBS) $(VBOX_PYTHONDEF_LIB_X86)
    305412endif
     413  endif
    306414 endif
    307415endif
  • trunk/src/libs/xpcom18a4/python/gen_python_deps.py

    r59836 r63775  
    1616from distutils.version import StrictVersion
    1717
    18 versions = ["2.6", "2.7", "3.1", "3.2", "3.3", "3.4", "3.5"]
     18versions = ["2.6", "2.7", "3.1", "3.2", "3.2m", "3.3", "3.3m", "3.4", "3.4m", "3.5", "3.5m"]
    1919prefixes = ["/usr", "/usr/local", "/opt", "/opt/local"]
    2020known = {}
    2121
    22 def checkPair(p, v,dllpre,dllsuff, bitness_magic):
    23     file =  os.path.join(p, "include", "python"+v, "Python.h")
    24     if not os.path.isfile(file):
     22def checkPair(p, v, dllpre, dllsuff, bitness_magic):
     23    incdir = os.path.join(p, "include", "python"+v)
     24    incfile = os.path.join(incdir, "Python.h")
     25    if not os.path.isfile(incfile):
    2526        return None
    2627
     
    2829    if not os.path.isfile(lib):
    2930        lib = os.path.join(p, "lib", dllpre+"python"+v+dllsuff)
     31        if not os.path.isfile(lib):
     32            lib = None
    3033
    3134    if bitness_magic == 1:
    3235        lib64 = os.path.join(p, "lib", "64", dllpre+"python"+v+dllsuff)
     36        if not os.path.isfile(lib64):
     37            lib64 = None
    3338    elif bitness_magic == 2:
    3439        lib64 = os.path.join(p, "lib/x86_64-linux-gnu", dllpre+"python"+v+dllsuff)
     
    3641            lib64 = os.path.join(p, "lib64", dllpre+"python"+v+dllsuff)
    3742            if not os.path.isfile(lib64):
    38                 lib64 = lib
     43                lib64 = os.path.join(p, "lib", dllpre+"python"+v+dllsuff)
    3944                if not os.path.isfile(lib64):
    40                     return None
    41 
     45                    lib64 = None
    4246    else:
    4347        lib64 = None
    44     return [os.path.join(p, "include", "python"+v), lib, lib64]
     48
     49    if lib is None and lib64 is None:
     50        return None
     51    else:
     52        return [incdir, lib, lib64]
    4553
    4654def print_vars(vers, known, sep, bitness_magic):
    4755    print("VBOX_PYTHON%s_INC=%s%s" %(vers, known[0], sep))
    4856    if bitness_magic > 0:
    49         print("VBOX_PYTHON%s_LIB=%s%s" %(vers, known[2], sep))
    50         print("VBOX_PYTHON%s_LIB_X86=%s%s" %(vers, known[1], sep))
     57        if known[2]:
     58            print("VBOX_PYTHON%s_LIB=%s%s" %(vers, known[2], sep))
     59        if known[1]:
     60            print("VBOX_PYTHON%s_LIB_X86=%s%s" %(vers, known[1], sep))
    5161    else:
    5262        print("VBOX_PYTHON%s_LIB=%s%s" %(vers, known[1], sep))
     
    95105
    96106    for v in versions:
    97         if StrictVersion(v) < StrictVersion('2.6'):
     107        if v.endswith("m"):
     108            realversion = v[:-1]
     109        else:
     110            realversion = v
     111        if StrictVersion(realversion) < StrictVersion('2.6'):
    98112            continue
    99113        for p in prefixes:
     
    111125        if d is None:
    112126            d = k
    113         vers = k.replace('.', '')
     127        vers = k.replace('.', '').upper()
    114128        print_vars(vers, known[k], sep, bitness_magic)
    115129    if d is not None:
  • trunk/src/libs/xpcom18a4/python/vboxxpcom.py

    r60492 r63775  
    3434    'VBoxPython' + str(sys.version_info[0]),
    3535    'VBoxPython'
    36 ];
     36]
     37
     38# For Python 3.2 and later use the right ABI flag suffix for the module.
     39if sys.hexversion >= 0x030200f0 and sys.abiflags:
     40    _asNew = []
     41    for sCandidate in _asVBoxPythons:
     42        if isdigit(sCandidate[-1:]):
     43            _asNew.append(sCandidate + sys.abiflags)
     44        else:
     45            _asNew.append(sCandidate)
     46    _asVBoxPythons = _asNew
     47    del _asNew
    3748
    3849# On platforms where we ship both 32-bit and 64-bit API bindings, we have to
    3950# look for the right set if we're a 32-bit process.
    4051if platform.system() in [ 'SunOS', ] and sys.maxsize <= 2**32:
    41     _asNew = [ sCandidate + '_x86' for sCandidate in _asVBoxPythons ];
    42     _asNew.extend(_asVBoxPythons);
    43     _asVBoxPythons = _asNew;
    44     del _asNew;
     52    _asNew = [ sCandidate + '_x86' for sCandidate in _asVBoxPythons ]
     53    _asNew.extend(_asVBoxPythons)
     54    _asVBoxPythons = _asNew
     55    del _asNew
    4556
    4657# On Darwin (aka Mac OS X) we know exactly where things are in a normal
     
    6576
    6677if _oVBoxPythonMod == None:
    67     raise Exception('Cannot find VBoxPython module (tried: %s)' % (', '.join(_asVBoxPythons),));
     78    raise Exception('Cannot find VBoxPython module (tried: %s)' % (', '.join(_asVBoxPythons),))
    6879
    69 sys.modules['xpcom._xpcom'] = _oVBoxPythonMod;
    70 xpcom._xpcom = _oVBoxPythonMod;
     80sys.modules['xpcom._xpcom'] = _oVBoxPythonMod
     81xpcom._xpcom = _oVBoxPythonMod
    7182
Note: See TracChangeset for help on using the changeset viewer.

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