File: rules

package info (click to toggle)
python-biopython 1.85%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 126,372 kB
  • sloc: xml: 1,047,995; python: 332,722; ansic: 16,944; sql: 1,208; makefile: 140; sh: 81
file content (195 lines) | stat: -rwxr-xr-x 6,422 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/usr/bin/make -f

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

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

# Fix partially build reproducibility issues.  Also, refrain from
# meddling with build user's home directory.
export HOME = /nonexistent

# Directory mainly holding chemical components data for dssp.
export LIBCIFPP_DATA_DIR = $(CURDIR)/libcifpp-data

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

# 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 \
	PopGen_GenePop \
	PopGen_GenePop_EasyController \
	XXmotif_tool \
	PDB_ResidueDepth \
	mmtf \
	mmtf_online \
	GraphicsBitmaps

# avoid amd64 only tools on other architectures
ifneq ($(BUILDARCH),amd64)
    EXCLUDEARCH=raxml_tool
endif

ifeq ($(BUILDARCH),riscv64)
    # FIXME: the below test is affected by #1080479, and can be
    # restored once it is resolved.
    EXCLUDEARCH+=NCBI_BLAST_tools
endif

ifeq ($(BUILDARCH),mips64el)
    # FIXME: bwa on mips64el is affected by the following issue, so
    # skipping for now:
    #
    #   Bio.Application.ApplicationError: Non-zero return code 138 from
    #   'bwa mem BWA/human_g1k_v37_truncated.fasta
    #   BWA/HNSCC1_1_truncated.fastq BWA/HNSCC1_2_truncated.fastq',
    #   message '[M::bwa_idx_load_from_disk] read 0 ALT contigs'
    EXCLUDEARCH+=BWA_tool
endif

ifeq ($(BUILDARCH),s390x)
    # PDB binary cif parsing is non-working on big endian platforms.
    # The parsing is fed to C code which would need potientially
    # heavier-than-first-thought rewrite to get the issue sorted.
    EXCLUDEARCH+=PDB_binary_cif
    EXCLUDEARCH+=Tutorial
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

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

override_dh_auto_clean:
	dh_auto_clean
	cd Doc && make clean
	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
	find Doc -name "*.pygtex" -o -name "*.pygstyle" -delete
	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
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(CURDIR)/.pybuild/cpython3_$(shell py3versions -dv)/build \
	$(MAKE) -C Doc html
endif

override_dh_auto_install:
	dh_auto_install
	dh_numpy3 -ppython3-biopython

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -e \
	; for avoid in \
		$(EXCLUDENONFREE) \
		$(EXCLUDENOTPACKAGED) \
		$(EXCLUDEARCH) \
		$(EXCLUDEDATABASE) \
	; do mkdir -p Tests_avoid \
	;    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
	# Prepare resources necessary to dssp.
	mkdir -pv $(LIBCIFPP_DATA_DIR)
	cp -v /usr/share/libcifpp/mmcif_pdbx.dic $(LIBCIFPP_DATA_DIR)
	cp -v /usr/share/libcifpp/mmcif_ma.dic $(LIBCIFPP_DATA_DIR)
	cp -v debian/tests/mini-ccd.cif $(LIBCIFPP_DATA_DIR)/components.cif
	# We also keep the tests we need to avoid for later inspection
	test ! -d Tests_avoid || 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 {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'
	# Cleanup steps after tests.
	set -e \
	; if [ -d Tests_avoid ] \
	; then mv Tests_avoid/* Tests \
	;      rmdir Tests_avoid \
	; fi
	rm -r $(LIBCIFPP_DATA_DIR)
endif

DOCPKG = python-biopython-doc
DOCDIR = $(CURDIR)/debian/$(DOCPKG)/usr/share/doc/$(DOCPKG)
override_dh_installdocs-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	dh_installdocs -i
	find debian -name __pycache__ -type d | xargs rm -rf
	# 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
	# The following line breaks the build with nocheck, but
	# we can't remove it yet because doing so seems to break autopkgtests
	cp -a debian/tmp_tests/* $(DOCDIR)

	# Tackle privacy breaches caused by MathML.
	sed -i 's@https://cdn.jsdelivr.net/npm/mathjax\@3/es5/tex-mml-chtml.js@file:///usr/share/nodejs/mathjax-full/es5/tex-mml-chtml.js@' \
		$(DOCDIR)/html/Tutorial/*.html \
		$(DOCDIR)/html/index.html

	# Clean fonts that made their way to the documentation package.
	rm -rvf $(DOCDIR)/html/_static/fonts/

	# Use Debian provided Javascript files.
	rm -v $(DOCDIR)/html/_static/jquery.js
	ln -sv /usr/share/javascript/jquery/jquery.js \
		$(DOCDIR)/html/_static/jquery.js
	rm -v $(DOCDIR)/html/_static/doctools.js
	ln -sv /usr/share/javascript/sphinxdoc/1.0/doctools.js \
		$(DOCDIR)/html/_static/doctools.js
	rm -v $(DOCDIR)/html/_static/language_data.js
	ln -sv /usr/share/javascript/sphinxdoc/1.0/language_data.js \
		$(DOCDIR)/html/_static/language_data.js
	rm -v $(DOCDIR)/html/_static/searchtools.js
	ln -sv /usr/share/javascript/sphinxdoc/1.0/searchtools.js \
		$(DOCDIR)/html/_static/searchtools.js
endif

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