From ea52864b0007d6800b2c9315cbe2e9257ccf6adf Mon Sep 17 00:00:00 2001 From: jay <jlaura@usgs.gov> Date: Tue, 14 Aug 2018 13:54:32 -0700 Subject: [PATCH] Correct installation --- python/setup.py.in | 25 +++++++++++++++++++++++-- tests/test_functional.py | 4 +++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/python/setup.py.in b/python/setup.py.in index 1494b0d..886b272 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -2,13 +2,34 @@ import setuptools.command.install import shutil from distutils.sysconfig import get_python_lib +class CompiledLibInstall(setuptools.command.install.install): + """ + Specialized install to install to python libs + """ + + def run(self): + """ + Run method called by setup + :return: + """ + # Get filenames from CMake variable + filenames = '${PYTHON_INSTALL_FILES}'.split(';') + + # Directory to install to + install_dir = get_python_lib() + + # Install files + [shutil.copy(filename, install_dir) for filename in filenames] + if __name__ == '__main__': setuptools.setup( name='csmapi', version='0.1.0', - py_modules=['csmapi'], - package_data={'csmapi':['_csmapi.so']}, + packages=['csmapi'], + cmdclass={'install':CompiledLibInstall}, license='UnLicense', author='jlaura', + zip_safe=False, author_email='jlaura@usgs.gov' ) + \ No newline at end of file diff --git a/tests/test_functional.py b/tests/test_functional.py index 2a58b63..f7cf22d 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -8,7 +8,9 @@ import pytest import csmapi # Load a plugin with CSM compliant sensors -lib = ctypes.CDLL('/data/big/github/CSM-CameraModel/build/libusgscsm.so') +from ctypes.util import find_library + +lib = ctypes.CDLL(find_library('usgscsm.so')) @pytest.fixture def datadir(tmpdir, request): -- GitLab