Merge pull request #1515 from akva2/python_debian_packaging

Add debian packaging of python bindings
This commit is contained in:
Arne Morten Kvarving
2020-02-26 12:22:01 +01:00
committed by GitHub
7 changed files with 39 additions and 14 deletions

View File

@@ -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)

25
debian/control vendored
View File

@@ -2,10 +2,12 @@ Source: opm-common
Priority: extra
Maintainer: Arne Morten Kvarving <arne.morten.kvarving@sintef.no>
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

1
debian/libopm-common1-bin.install vendored Normal file
View File

@@ -0,0 +1 @@
usr/bin/*

1
debian/python3-opm-common.install vendored Normal file
View File

@@ -0,0 +1 @@
usr/lib/python*/*

4
debian/rules vendored
View File

@@ -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

View File

@@ -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))

View File

@@ -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'.")