Fix PyAssimp under Python >= 3.12 and macOS library search support (#5397)
* Fix PyAssimp under Python >= 3.12 * Make PyAssimp search DYLD_LIBRARY_PATH under macOS --------- Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>pull/5465/head
parent
2d98f6a880
commit
ff5b0ae575
|
@ -5,13 +5,17 @@ Some fancy helper functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import ctypes
|
import ctypes
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
from distutils.sysconfig import get_python_lib
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
have_distutils = sys.version_info[0] < 3 and sys.version_info[1] < 12
|
||||||
|
if have_distutils:
|
||||||
|
from distutils.sysconfig import get_python_lib
|
||||||
|
|
||||||
try: import numpy
|
try: import numpy
|
||||||
except ImportError: numpy = None
|
except ImportError: numpy = None
|
||||||
|
|
||||||
|
@ -32,10 +36,14 @@ if os.name=='posix':
|
||||||
|
|
||||||
if 'LD_LIBRARY_PATH' in os.environ:
|
if 'LD_LIBRARY_PATH' in os.environ:
|
||||||
additional_dirs.extend([item for item in os.environ['LD_LIBRARY_PATH'].split(':') if item])
|
additional_dirs.extend([item for item in os.environ['LD_LIBRARY_PATH'].split(':') if item])
|
||||||
|
|
||||||
|
if platform.system() == 'Darwin':
|
||||||
|
if 'DYLD_LIBRARY_PATH' in os.environ:
|
||||||
|
additional_dirs.extend([item for item in os.environ['DYLD_LIBRARY_PATH'].split(':') if item])
|
||||||
|
|
||||||
# check if running from anaconda.
|
# check if running from anaconda.
|
||||||
anaconda_keywords = ("conda", "continuum")
|
anaconda_keywords = ("conda", "continuum")
|
||||||
if any(k in sys.version.lower() for k in anaconda_keywords):
|
if have_distutils and any(k in sys.version.lower() for k in anaconda_keywords):
|
||||||
cur_path = get_python_lib()
|
cur_path = get_python_lib()
|
||||||
pattern = re.compile('.*\/lib\/')
|
pattern = re.compile('.*\/lib\/')
|
||||||
conda_lib = pattern.match(cur_path).group()
|
conda_lib = pattern.match(cur_path).group()
|
||||||
|
|
Loading…
Reference in New Issue