Exemple #1
0
def sdkForPython(_cache=[]):
    """
    Return the SDK version used to compile Python itself,
    or None if no framework was used
    """
    if not _cache:

        cflags = _get_config_var('CFLAGS')
        m = _re.search('-isysroot\s+([^ ]*)(\s|$)', cflags)
        if m is None:
            _cache.append(None)
            return None


        path = m.group(1)
        if path == '/':
            result = tuple(map(int, os_release().split('.')))
            _cache.append(result)
            return result

        bn = _os.path.basename(path)
        version = bn[6:-4]
        if version.endswith('u'):
            version = version[:-1]


        result =  tuple(map(int, version.split('.')))
        _cache.append(result)
        return result

    return _cache[0]
def sdkForPython(_cache=[]):
    """
    Return the SDK version used to compile Python itself,
    or None if no framework was used
    """
    if not _cache:

        cflags = _get_config_var('CFLAGS')
        m = _re.search('-isysroot\s+([^ ]*)(\s|$)', cflags)
        if m is None:
            _cache.append(None)
            return None

        path = m.group(1)
        if path == '/':
            result = tuple(map(int, os_release().split('.')))
            _cache.append(result)
            return result

        bn = _os.path.basename(path)
        version = bn[6:-4]
        if version.endswith('u'):
            version = version[:-1]

        result = tuple(map(int, version.split('.')))
        _cache.append(result)
        return result

    return _cache[0]
Exemple #3
0
def sdkForPython(_cache=[]):
    """
    Return the SDK version used to compile Python itself,
    or None if no framework was used
    """
    if not _cache:

        cflags = _get_config_var('CFLAGS')
        m = _re.search('-isysroot ([^ ]*) ', cflags)
        if m is None:
            return None

        path = m.group(1)
        bn = _os.path.basename(path)
        version = bn[6:-4]
        if version.endswith('u'):
            version = version[:-1]

        return map(int, version.split('.'))

    return _cache[0]
Exemple #4
0
def sdkForPython(_cache=[]):
    """
    Return the SDK version used to compile Python itself,
    or None if no framework was used
    """
    if not _cache:

        cflags = _get_config_var('CFLAGS')
        m = _re.search('-isysroot ([^ ]*) ', cflags)
        if m is None:
            return None

        path = m.group(1)
        bn = _os.path.basename(path)
        version = bn[6:-4]
        if version.endswith('u'):
            version = version[:-1]

        return map(int, version.split('.'))

    return _cache[0]
Exemple #5
0
def get_config_var(var):
    return _get_config_var(var) or ''
Exemple #6
0
# Special dlopen flags are used when loading Boost Python shared library to
# make sure the same boost python runtime is shared between every modules,
# even if linked versions are different. It is necessary to share the same
# boost python registers, required for inter-operability between modules. Note
# that since Python3.8, PATH and the current working directory are no longer
# used for DLL resolution on Windows OS. One is expected to explicitly call
# `os.add_dll_directory` instead.
try:
    pyver_suffix = "".join(map(str, _sys.version_info[:2]))
    if _sys.platform.startswith('win'):
        lib_prefix = ""
        lib_suffix = ".dll"
    else:
        lib_prefix = "lib"
        lib_suffix = _get_config_var('SHLIB_SUFFIX')
    boost_python_lib = f"{lib_prefix}boost_python{pyver_suffix}{lib_suffix}"
    _ctypes.CDLL(boost_python_lib, _ctypes.RTLD_GLOBAL)
except OSError:
    pass

# Fix Dll seach path on windows for Python >= 3.8
if _sys.platform.startswith('win') and _sys.version_info >= (3, 8):
    _os.add_dll_directory(_os.path.join(_os.path.dirname(__file__), "lib"))
    for path in _os.environ['PATH'].split(_os.pathsep):
        if _os.path.exists(path):
            _os.add_dll_directory(path)

# Import dependencies, using embedded versions only if necessary
for module_name in ["eigenpy", "hppfcl", "pinocchio"]:
    if _importlib.util.find_spec(module_name) is not None:
Exemple #7
0
def get_config_var(var):
    return _get_config_var(var) or ''