Skip to content

Commit

Permalink
Fix PyAssimp under Python >= 3.12 and macOS library search support (a…
Browse files Browse the repository at this point in the history
…ssimp#5397)

* Fix PyAssimp under Python >= 3.12

* Make PyAssimp search DYLD_LIBRARY_PATH under macOS

---------

Co-authored-by: Kim Kulling <[email protected]>
  • Loading branch information
Th3T3chn0G1t and kimkulling authored Feb 8, 2024
1 parent 2d98f6a commit ff5b0ae
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions port/PyAssimp/pyassimp/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
"""

import os
import platform
import ctypes
import operator

from distutils.sysconfig import get_python_lib
import re
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
except ImportError: numpy = None

Expand All @@ -32,10 +36,14 @@

if 'LD_LIBRARY_PATH' in os.environ:
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.
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()
pattern = re.compile('.*\/lib\/')
conda_lib = pattern.match(cur_path).group()
Expand Down

0 comments on commit ff5b0ae

Please sign in to comment.