pack_wheel: Work on OS X with SIP
The old DYLD_LIBRARY_PATH tricks don't work any more (at least, not
while System Integrity Protection is on). Even just getting that into
os.environ seems difficult on recent OS X!
% DYLD_LIBRARY_PATH=$HOME/local/lib python -c \
'import os; print(os.environ.get("DYLD_LIBRARY_PATH"))'
None
LDFLAGS still get passed around OK, though, so go looking for extra
library search paths in them. Presumably there's something like
-L$HOME/local/lib
in there if the developer needs it.
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: I85f7a1b4308e01858bff5fccda1f5a4b54957da8
This commit is contained in:
@@ -72,6 +72,16 @@ def locate_library(name, missing_ok=False):
|
||||
if libpath:
|
||||
for d in libpath.split(':'):
|
||||
cmd.extend(['-L', d.rstrip('/')])
|
||||
should_read_path = False
|
||||
for flg in os.environ.get('LDFLAGS', '').split(' '):
|
||||
if should_read_path:
|
||||
cmd.append(flg)
|
||||
should_read_path = False
|
||||
elif flg == '-L':
|
||||
cmd.append(flg)
|
||||
should_read_path = True
|
||||
elif flg.startswith('-L'):
|
||||
cmd.append(flg)
|
||||
cmd.extend(['-o', os.devnull, '-l%s' % name])
|
||||
p = subprocess.run(cmd, capture_output=True, text=True)
|
||||
# Note that we don't expect the command to exit cleanly; we just want
|
||||
|
||||
Reference in New Issue
Block a user