From df4dda0d7da70d61cc511947c85d331ce77bc451 Mon Sep 17 00:00:00 2001 From: Andreas Tille Date: Tue, 11 Feb 2014 11:36:54 +0100 Subject: [PATCH] Enable proper cleaning by preserving original Cython created files. --- debian/python-pysam.install | 1 + debian/rules | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 debian/python-pysam.install diff --git a/debian/python-pysam.install b/debian/python-pysam.install new file mode 100644 index 0000000..13f83a7 --- /dev/null +++ b/debian/python-pysam.install @@ -0,0 +1 @@ +/usr/lib/python2.*/* diff --git a/debian/rules b/debian/rules index a1bc875..3c444f4 100755 --- a/debian/rules +++ b/debian/rules @@ -5,6 +5,23 @@ pybuilddir := $(CURDIR)/build/lib.$(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) %: dh $@ --with python2 +# Cython is recreating some c-files. To enable building twice in a row these +# will be saved in advance and restored afterwards +debian/savefiles: + mkdir -p debian/savefiles + cp -a `grep -l "Generated by Cython" pysam/*.c` debian/savefiles + +override_dh_clean: + dh_clean + # restore cython generated files + if [ -d debian/savefiles ] ; then \ + mv debian/savefiles/* pysam ; \ + rm -rf debian/savefiles ; \ + fi + +override_dh_auto_build: debian/savefiles + dh_auto_build + override_dh_auto_test: dh_auto_test chmod a+x tests/pysam_test_offline.py @@ -15,10 +32,6 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) done endif -override_dh_install: - echo '/usr/lib/python2.*/*' >> debian/python-pysam.install - dh_install - override_dh_auto_clean: dh_auto_clean cd tests; make clean -- 2.30.2