histogram/build/get_python_library.py
Hans Dembinski bf945d990e fix osx
2018-07-17 21:36:27 +02:00

25 lines
574 B
Python

from distutils import sysconfig
import os
import sys
import pprint
pj = os.path.join
d = sysconfig.get_config_vars()
for required_key in ("LDLIBRARY", "LIBDEST", "LIBDIR", "LIBPL"):
if required_key not in d:
pprint("some keys not found, dumping config:")
pprint(d)
raise SystemExit(1)
library = d["LDLIBRARY"]
for libpath in ('LIBDEST', 'LIBDIR', 'LIBPL'):
p = pj(d[libpath], library)
if os.path.exists(p):
sys.stdout.write(p)
raise SystemExit
pprint("no library found, dumping config:")
pprint(d)
raise SystemExit(1)