Commit 327152cd authored by James Browning's avatar James Browning
Browse files

nyp.ntpc, bin_test: (ab)use CTYPESDIR when testing install.

parent 51a660d6
Pipeline #221155473 passed with stage
in 2 minutes and 12 seconds
......@@ -11,29 +11,38 @@ import sys
import ntp.poly
LIB = 'ntpc'
CTD = 'CTYPESDIR'
def _fmt():
def _libname():
"""Produce library naming scheme."""
if sys.platform.startswith('darwin'):
return 'lib%s.dylib'
if sys.platform.startswith('win32'):
return '%s.dll'
if sys.platform.startswith('cygwin'):
return 'lib%s.dll'
return 'lib%s.so'
_format = 'lib%s.so'
_templates = {
'darwin': 'lib%s.dylib',
'win32': '%s.dll',
'cygwin': 'lib%s.dll'
}
for key in _templates:
if sys.platform.startswith(key):
_format = _templates[key]
break
return _format % LIB
def _importado():
"""Load the ntpc library or throw an OSError trying."""
ntpc_paths = [] # places to look
j = __file__.split(os.sep)[:-1]
ntpc_paths.append(os.sep.join(j + [_fmt() % LIB]))
if CTD in os.environ: # and not sys.platform.startswith('linux'):
ntpc_paths.append(os.environ[CTD] +
os.sep + _libname())
else:
j = __file__.split(os.sep)[:-1]
ntpc_paths.append(os.sep.join(j + [_libname()]))
ntpc_path = ctypes.util.find_library(LIB)
if ntpc_path:
ntpc_paths.append(ntpc_path)
ntpc_path = ctypes.util.find_library(LIB)
if ntpc_path:
ntpc_paths.append(ntpc_path)
return _dlo(ntpc_paths)
......
......@@ -104,8 +104,10 @@ def cmd_bin_test(ctx):
path = spath = None
if ctx.cmd == 'install':
pypath = destdir + ctx.env.PYTHONARCHDIR # + os.sep + 'ntp'
env = {'PYTHONPATH': pypath} if destdir != '/' else {}
pypath = destdir + ctx.env.PYTHONARCHDIR
libpath = destdir + ctx.env.LIBDIR
env = {'PYTHONPATH': pypath,
'CTYPESDIR': libpath }
path = destdir + os.sep if destdir != '/' else '/'
spath = path + ctx.env.SBINDIR[1:] + os.sep
path = path + ctx.env.BINDIR[1:] + os.sep
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment