[med-svn] [odil] 01/01: Add creation of Python 3 packages

Julien Lamy lamy-guest at moszumanska.debian.org
Thu Dec 22 06:57:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

lamy-guest pushed a commit to branch master
in repository odil.

commit 68041c4ac63cc400873b993d6e23030c835ace53
Author: Julien Lamy <lamy at unistra.fr>
Date:   Thu Dec 22 07:57:30 2016 +0100

    Add creation of Python 3 packages
---
 debian/control              | 24 ++++++++++++++++++--
 debian/libodil0-doc.docs    |  2 +-
 debian/python-odil.install  |  2 +-
 debian/python3-odil.install |  1 +
 debian/rules                | 55 ++++++++++++++++++++++++++++++++++++++++-----
 5 files changed, 74 insertions(+), 10 deletions(-)

diff --git a/debian/control b/debian/control
index 87475d8..bec31ff 100644
--- a/debian/control
+++ b/debian/control
@@ -20,14 +20,17 @@ Build-Depends: debhelper (>= 9),
                libboost-test-dev (>= 1.46.1),
                chrpath,
                dcmtk (>= 3.6.0),
-               python,
-               python-nose
+               python-dev,
+               python3-dev,
+               python-nose,
+               python3-nose
 Build-Depends-Indep: doxygen, graphviz
 Standards-Version: 3.9.8
 Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/odil.git
 Vcs-Git: https://anonscm.debian.org/git/debian-med/odil.git
 Homepage: https://github.com/lamyj/odil
 X-Python-Version: >= 2.7
+X-Python3-Version: >= 3.4
 
 Package: libodil0
 Architecture: any
@@ -103,6 +106,23 @@ Description: C++11 library for the DICOM standard (Python wrappers)
  .
  This package contains the Python wrappers.
 
+Package: python3-odil
+Architecture: any
+Section: python
+Depends: libodil0 (= ${binary:Version}),
+         ${shlibs:Depends},
+         ${python3:Depends},
+         ${misc:Depends}
+Multi-Arch: foreign
+Description: C++11 library for the DICOM standard (Python 3 wrappers)
+ Odil leverages C++ constructs to provide a user-friendly API of the 
+ different parts of the DICOM standard. Included in Odil are exception-based
+ error handling, generic access to datasets elements, standard JSON and XML 
+ representation of datasets, and generic implementation of messages, clients
+ and servers for the various DICOM protocols.
+ .
+ This package contains the Python 3 wrappers.
+
 Package: odil
 Architecture: all
 Depends: python-odil, python, ${misc:Depends}
diff --git a/debian/libodil0-doc.docs b/debian/libodil0-doc.docs
index 8ef7856..0bd3136 100644
--- a/debian/libodil0-doc.docs
+++ b/debian/libodil0-doc.docs
@@ -1 +1 @@
-build/doc/html
+doc/html
diff --git a/debian/python-odil.install b/debian/python-odil.install
index d55417f..435c988 100644
--- a/debian/python-odil.install
+++ b/debian/python-odil.install
@@ -1 +1 @@
-build/wrappers/odil.so usr/lib/python2.7/dist-packages/
+build-py2.7/wrappers/odil.so usr/lib/python2.7/dist-packages/
diff --git a/debian/python3-odil.install b/debian/python3-odil.install
new file mode 100644
index 0000000..0a7fc69
--- /dev/null
+++ b/debian/python3-odil.install
@@ -0,0 +1 @@
+build-py3.4/wrappers/odil.so usr/lib/python3.4/dist-packages/
diff --git a/debian/rules b/debian/rules
index 6b22852..93efb81 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,19 +3,58 @@
 export DEB_CXXFLAGS_MAINT_APPEND  = -std=c++0x
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
+# Find all Python versions
+PYTHON2=$(shell pyversions -vr)
+PYTHON3=$(shell py3versions -vr)
+ALLPY=$(PYTHON2) $(PYTHON3)
+
 %:
-	dh $@ --builddirectory=build --parallel --with python2
+	dh $@ --builddirectory=build --parallel --with python2,python3
+
+# Base build: no wrappers
+override_dh_auto_configure-arch:
+	dh_auto_configure -- -DBUILD_WRAPPERS=OFF
+
+override_dh_auto_build-nopy:
+	dh_auto_build
+	mv build build-nopy
+
+# Reconfigure base build for specific Python version and build wrappers
+override_dh_auto_build-py%: override_dh_auto_build-nopy
+	cp -a build-nopy build
+	dh_auto_configure -- \
+	  -DBUILD_WRAPPERS=ON -DPython_ADDITIONAL_VERSIONS=$*
+	dh_auto_build
+	mv build build-py$*
+
+override_dh_auto_build-arch: override_dh_auto_build-nopy $(ALLPY:%=override_dh_auto_build-py%)
 
 override_dh_auto_build-indep:
-	mkdir -pv build
-	doxygen && mv -v doc build
+	doxygen
 
-override_dh_auto_test-arch:
-	cd build && ../tests/run --no-network
+# Run C++ tests only on base build
+override_dh_auto_test-arch-nopy:
+	ln -s build-nopy build
+	cd build && ../tests/run --no-network -e ".*"
+	rm build
+
+# Run Python tests only on python build
+override_dh_auto_test-arch-py%:
+	ln -s build-py$* build
+	cd build && ../tests/run --no-network -E ".*"
+	rm build
+
+override_dh_auto_test-arch: override_dh_auto_test-arch-nopy $(ALLPY:%=override_dh_auto_test-arch-py%)
+
+# Only auto_install base buid: wrappers are installed with *.install files
+override_dh_auto_install-arch:
+	ln -s build-nopy build
+	dh_auto_install
+	rm build
 
 override_dh_install-arch:
 	dh_install
-	chrpath -d debian/python-odil/usr/lib/python*/dist-packages/odil.so
+	chrpath -d debian/python*-odil/usr/lib/python*/dist-packages/odil*.so
 	d-shlibmove \
 		--commit --multiarch --exclude-a --exclude-la \
 		--movedev debian/tmp/usr/include/* usr/include \
@@ -28,6 +67,10 @@ override_dh_install-arch:
                 --override s/libboost_system.*-dev/libboost-system-dev/ \
 		debian/tmp/usr/lib/*.so
 
+override_dh_clean:
+	dh_clean
+	rm -rf build-nopy $(ALLPY:%=build-py%) doc
+
 # These steps are not needed for arch-independent packages
 override_dh_auto_configure-indep:
 override_dh_auto_test-indep:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/odil.git



More information about the debian-med-commit mailing list