diff --git a/CMakeLists.txt b/CMakeLists.txt index b56c692e7..21c84f178 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,7 +319,7 @@ if (OPM_ENABLE_PYTHON) # testing. add_test(NAME python_tests WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python - COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext --dry-run --build-lib ${PROJECT_BINARY_DIR}/python/python/opm test + COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/lib ${PYTHON_EXECUTABLE} setup.py build_ext --dry-run --build-lib ${PROJECT_BINARY_DIR}/python/python/opm test ) set_target_properties(opmcommon PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/debian/control b/debian/control index 2e3fc56ae..492d4c2ff 100644 --- a/debian/control +++ b/debian/control @@ -2,10 +2,12 @@ Source: opm-common Priority: extra Maintainer: Arne Morten Kvarving Build-Depends: build-essential, debhelper (>= 9), - pkg-config, cmake, git, libtool, doxygen, + pkg-config, cmake, git, libtool, doxygen, graphviz, texlive-latex-extra, texlive-latex-recommended, ghostscript, libboost-system-dev, libboost-test-dev, - zlib1g-dev + zlib1g-dev, libpython3-dev, python3-numpy, python3-distutils, + python3-setuptools, python3-setuptools-scm, python3-pytest-runner, + python3-decorator Standards-Version: 3.9.2 Section: libs Homepage: http://opm-project.org @@ -22,6 +24,16 @@ Provides: libopm-common Description: OPM common library The OPM common library contains generic code shared across all OPM modules. +Package: libopm-common1-bin +Section: libs +Pre-Depends: ${misc:Pre-Depends} +Architecture: any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Provides: libopm-common-bin +Description: OPM common binaries + The OPM common binaries. + Package: libopm-common1-dev Section: libdevel Architecture: any @@ -41,3 +53,12 @@ Provides: libopm-common-doc Description: OPM common library -- documentation The OPM common library contains the shared buildsystem and helpers shared across all OPM modules. + +Package: python3-opm-common +Section: libs +Pre-Depends: ${misc:Pre-Depends}, multiarch-support +Architecture: any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends}, libopm-common1, python3-numpy, python3-decorator +Description: OPM common python bindings + Python package for opm-common diff --git a/debian/libopm-common1-bin.install b/debian/libopm-common1-bin.install new file mode 100644 index 000000000..1df36c612 --- /dev/null +++ b/debian/libopm-common1-bin.install @@ -0,0 +1 @@ +usr/bin/* diff --git a/debian/python3-opm-common.install b/debian/python3-opm-common.install new file mode 100644 index 000000000..970cf8075 --- /dev/null +++ b/debian/python3-opm-common.install @@ -0,0 +1 @@ +usr/lib/python*/* diff --git a/debian/rules b/debian/rules index 0af0ca133..ca3100158 100755 --- a/debian/rules +++ b/debian/rules @@ -10,7 +10,7 @@ #export DH_VERBOSE=1 %: - dh $@ + dh $@ --parallel override_dh_auto_clean: dh_auto_clean --buildsystem=cmake @@ -20,7 +20,7 @@ override_dh_auto_build: # consider using -DUSE_VERSIONED_DIR=ON if backporting override_dh_auto_configure: - dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-common1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF + dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-common1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DOPM_ENABLE_PYTHON=1 -DOPM_INSTALL_PYTHON=1 -DPYTHON_EXECUTABLE=/usr/bin/python3 override_dh_auto_install: dh_auto_install -- install-html diff --git a/python/install.py b/python/install.py index 8cb1d65e1..f67fd037c 100644 --- a/python/install.py +++ b/python/install.py @@ -7,6 +7,9 @@ import filecmp src_root = sys.argv[1] target_prefix = sys.argv[2] install = int(sys.argv[3]) +target_destdir = os.environ.get("DESTDIR", "") +if not target_destdir is "": + target_prefix = target_destdir + target_prefix if not os.path.isdir(src_root): sys.exit("No such directory: {}".format(src_root)) diff --git a/python/setup.py b/python/setup.py index 8da7c3c72..d88acc284 100644 --- a/python/setup.py +++ b/python/setup.py @@ -19,22 +19,21 @@ setupdir = os.path.dirname(__file__) if setupdir != '': os.chdir( setupdir ) +cc = os.environ.get("CC", "c++") try: subprocess.call(['ccache', '--version']) - cc = os.environ.get("CC", "c++") os.environ['CC'] = 'ccache {}'.format(cc) print("Using 'ccache {}' as compiler".format(cc)) - - # This is very hacky but so is the entire setup.py buildsystem. - output=subprocess.check_output([cc, "--version"]) - libs=['opmcommon', 'boost_system'] - output=str(output) - if output.find('Free Software Foundation'): - libs.append('stdc++fs') - except OSError as e: print('\nNOTE: please install ccache for faster compilation of python bindings.\n') +# This is very hacky but so is the entire setup.py buildsystem. +output=subprocess.check_output([cc, "--version"]) +libs=['opmcommon', 'boost_system'] +output=str(output) +if output.find('Free Software Foundation'): + libs.append('stdc++fs') + if 'build' in sys.argv: if not 'build_ext' in sys.argv: raise TypeError("Missing option 'build_ext'.")