File: rules

package info (click to toggle)
python-biopython 1.73%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 57,852 kB
  • sloc: python: 169,977; xml: 97,539; ansic: 15,653; sql: 1,208; makefile: 159; sh: 63
file content (137 lines) | stat: -rwxr-xr-x 6,326 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

#export PYBUILD_NAME=biopython
#export PYBUILD_DESTDIR_python2=debian/python-biopython/
#export PYBUILD_DESTDIR_python3=debian/python3-biopython/

# export DEB_BUILD_MAINT_OPTIONS = hardening=+all ... does not build
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

# Fails to build with this option switched on
# export DEB_BUILD_MAINT_OPTIONS = hardening=+all

BUILDARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)

# If `$(CURDIR)/setup.py test` would be called these tests need to be excluded since they require to be online
#EXCLUDEONLINE=Entrez_online HotRand NCBI_qblast SCOP_online SeqIO_online TogoWS
# Since `run_texts.py --online` is used the test requiring online connections are excluded by the test suite
EXCLUDEONLINE=

# avoid PAML_tools and EmbossPhylipNew since paml resp. embassy-phylip are non-free
# This would not trigger a failure but bloats the build log with irrelevant noise
EXCLUDENONFREE=PAML_tools EmbossPhylipNew

# avoid testing tools that are not packaged for Debian yet (or will never be packaged since they might be outdated)
# This would not trigger a failure but bloats the build log with irrelevant noise
EXCLUDENOTPACKAGED=MSAProbs_tool NACCESS_tool PopGen_DFDist PopGen_FDist PopGen_GenePop PopGen_GenePop_EasyController PopGen_SimCoal XXmotif_tool

# avoid amd64 only tools on other architectures
ifeq ($(BUILDARCH),amd64)
    EXCLUDEARCHamd64=
else
    EXCLUDEARCHamd64=BWA_tool raxml_tool
endif

# avoid tests requiring data base connections if no server is running while we are doing the build
# This would not trigger a failure but bloats the build log with irrelevant noise
EXCLUDEDATABASE=BioSQL_MySQLdb BioSQL_psycopg2

# With recent phyml we get:
# ApplicationError: Non-zero return code 255 from 'phyml -i Phylip/interlaced2.phy -d aa', message 'beignet-opencl-icd: no supported GPU found, this is probably the wrong opencl-icd package for this hardware'
# See https://bugs.debian.org/813262
EXCLUDEFAILINGTESTS=phyml_tool

%:
	dh $@ --with python2,python3 --buildsystem=pybuild

override_dh_auto_clean:
	dh_auto_clean
	cd Doc && make distclean
	rm -f Doc/install/Installation.pdf
	rm -f Doc/install/Installation.txt
	rm -f Doc/install/Installation.html
	rm -f Doc/Tutorial.pdf Doc/biopdb_faq.pdf
	rm -f Doc/Tutorial/*.aux
	rm -rf biopython.egg-info
	rm -rf .pybuild
	
	if [ -d Tests_avoid ] ; then \
	    mv Tests_avoid/* Tests ; \
	    rmdir Tests_avoid ; \
	fi
	
	rm -rf debian/tmp_tests

override_dh_auto_build:
	dh_auto_build
	cd Doc && make

override_dh_auto_install:
	dh_auto_install
	dh_numpy -ppython-biopython
	dh_numpy3 -ppython3-biopython

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
ifeq ($(BUILDARCH),mips)
	echo "***************************************************************************"
	echo "* Attention: Build time tests for mips architecture are skipped.          *"
	echo "* The reason is that the tests are known to fail for Python3 and the      *"
	echo "* effort to simply run only for Python 2.7 seems to be error prone.       *"
	echo "* Upstream is working on a solution so this should be dropped for         *"
	echo "* next upstream version. See:                                             *"
	echo "* http://mailman.open-bio.org/pipermail/biopython/2014-August/015383.html *"
	echo "***************************************************************************"
else
	mkdir -p Tests_avoid
	for avoid in $(EXCLUDEONLINE) $(EXCLUDENONFREE) $(EXCLUDENOTPACKAGED) $(EXCLUDEARCHamd64) $(EXCLUDEDATABASE) $(EXCLUDEFAILINGTESTS) $(EXCLUDEPACKAGEINFLUX) \
		    ; do \
	    mv Tests/test_$${avoid}.py Tests_avoid ; \
	done
	# For the doc package we need a clean testsuite without all the remaining files.  So keep a clean copy here
	mkdir -p debian/tmp_tests
	cp -a Tests debian/tmp_tests
	# remove duplicated file
	rm -f debian/tmp_tests/Tests/Quality/example.fastq.gz
	# We also keep the tests we need to avoid for later inspection
	cp -a Tests_avoid debian/tmp_tests
	# in the Debian package dialign it is not needed to set DIALIGN2_DIR but the test is verifying this dir
	# to run the EMBOSS test test_Emboss also requires to have the environment variable EMBOSS_ROOT set
	LC_ALL=C.UTF-8 dh_auto_test -- --test --system=custom \
		--test-args='set -e; \
                             mkdir -p {build_dir}/home; \
                             mkdir -p {build_dir}/Doc/examples; \
                             cp -a Doc/Tutorial.tex {build_dir}/Doc; \
                             cp -a Doc/Tutorial {build_dir}/Doc; \
                             cp -a Doc/examples {build_dir}/Doc; \
                             cp -a Tests {build_dir}; \
                             cd {build_dir}/Tests; \
                             env DIALIGN2_DIR=/usr/share/dialign EMBOSS_ROOT=/usr/lib/emboss HOME={build_dir}/home {interpreter} run_tests.py --offline'
	mv Tests_avoid/* Tests
	rmdir Tests_avoid
endif
endif

override_dh_installdocs-indep:
	dh_installdocs -i
	find debian -name __pycache__ -type d | xargs rm -rf
	find debian -name example.fastq.gz
	# dh_installdocs seems to refuse copying zero length files (for instance Tests/Blast/tab_2226_tblastn_002.txt) but these are needed for the tests as well
	cp -a debian/tmp_tests/* $(CURDIR)/debian/python-biopython-doc/usr/share/doc/python-biopython-doc/
	find debian -name .cvsignore -delete
	# no idea why Doc dir ends up in /usr/share/doc/python-biopython since biopython 1.71 - just move it into right place
	if [ -d debian/python-biopython-doc/usr/share/doc/python-biopython/Doc ] ; then \
	    mv debian/python-biopython-doc/usr/share/doc/python-biopython/Doc debian/python-biopython-doc/usr/share/doc/python-biopython-doc/Doc ; \
	fi
	cd debian/python-biopython-doc/usr/share/doc/python-biopython-doc/Doc && make clean
	find debian/python-biopython-doc/usr/share/doc/python-biopython-doc/Doc -name Makefile -delete
	find debian/python-biopython-doc/usr/share/doc/python-biopython-doc/Doc -name "*.aux" -delete
	find debian/python-biopython-doc/usr/share/doc/python-biopython-doc/Doc -name "*.lyx" -delete
	find debian/python-biopython-doc/usr/share/doc/python-biopython-doc/Doc -type d -empty -delete

override_dh_fixperms:
	dh_fixperms
	find debian -name "*.dtd" -exec chmod -x \{\} \;