diff --git a/python/setup.py.in b/python/setup.py.in index 1494b0d525a07891e713c8e265f7e343dd27aeee..886b27206ad1c475971b1baae58053590bba2a27 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 2a58b635799911b133e49ba71944c8a94216d26e..f7cf22d5a6e26c314454a018365266106d240ad0 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):