Skip to content

Commit a524212

Browse files
Merge pull request #873 from hroncok/no_invalid_runpath
Stop adding PYTHON_CFGDIR to LD_RUN_PATH and PYTHON_LDFLAGS if there is no libpython
2 parents f09c8a1 + 7532634 commit a524212

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

setup.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,21 @@ def get_apu_includes():
300300
if not os.path.exists(PYTHON_CFGDIR):
301301
PYTHON_CFGDIR = '%s-%s' % (PYTHON_CFGDIR, sys.platform)
302302

303-
PYTHON_LDFLAGS = ['-L%s' % PYTHON_CFGDIR]
303+
PYTHON_LDFLAGS = []
304304
if PYTHON_LIBDIR != APXS_LIBDIR:
305-
PYTHON_LDFLAGS.insert(0, '-L%s' % PYTHON_LIBDIR)
305+
PYTHON_LDFLAGS.append('-L%s' % PYTHON_LIBDIR)
306306

307307
PYTHON_LDLIBS = ['-lpython%s' % PYTHON_LDVERSION]
308308

309309
if os.path.exists(os.path.join(PYTHON_LIBDIR,
310310
'libpython%s.a' % PYTHON_VERSION)):
311311
PYTHON_LDLIBS = ['-lpython%s' % PYTHON_VERSION]
312+
PYTHON_LDFLAGS.append('-L%s' % PYTHON_CFGDIR)
312313

313314
if os.path.exists(os.path.join(PYTHON_CFGDIR,
314315
'libpython%s.a' % PYTHON_VERSION)):
315316
PYTHON_LDLIBS = ['-lpython%s' % PYTHON_VERSION]
317+
PYTHON_LDFLAGS.append('-L%s' % PYTHON_CFGDIR)
316318

317319
# Create the final set of compilation flags to be used.
318320

@@ -326,13 +328,16 @@ def get_apu_includes():
326328
LD_RUN_PATHS = []
327329
if os.name != 'nt':
328330
LD_RUN_PATH = os.environ.get('LD_RUN_PATH', '')
329-
LD_RUN_PATHS = [PYTHON_CFGDIR]
331+
LD_RUN_PATHS = []
332+
if '-L%s' % PYTHON_CFGDIR in PYTHON_LDFLAGS:
333+
LD_RUN_PATHS.append(PYTHON_CFGDIR)
330334
if PYTHON_LIBDIR != APXS_LIBDIR:
331335
LD_RUN_PATHS.insert(0, PYTHON_LIBDIR)
332336
LD_RUN_PATH += ':' + ':'.join(LD_RUN_PATHS)
333337
LD_RUN_PATH = LD_RUN_PATH.lstrip(':')
334338

335-
os.environ['LD_RUN_PATH'] = LD_RUN_PATH
339+
if LD_RUN_PATH:
340+
os.environ['LD_RUN_PATH'] = LD_RUN_PATH
336341

337342
# On MacOS X, recent versions of Apple's Apache do not support compiling
338343
# Apache modules with a target older than 10.8. This is because it

0 commit comments

Comments
 (0)