summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 86307493376d420c50a2c4fec25b297a4b67d018 (plain)
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
#!/usr/bin/make -f

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

# Prevent setuptools/distribute from accessing the internet.
export http_proxy = http://127.0.0.1:9

package=python-gnupg-ng
package3=python3-gnupg-ng

export PYBUILD_DESTDIR_python2=debian/$(package)/
export PYBUILD_DESTDIR_python3=debian/$(package3)/

WITH_SPHINXDOC = $(shell if [ -x /usr/bin/dh_sphinxdoc ]; then echo "--with sphinxdoc"; fi)

PYVERS=$(shell pyversions -r)
PY3VERS = $(shell py3versions -r)

%:
	dh $@ --with python2,python3 $(WITH_SPHINXDOC) --buildsystem=python_distutils


override_dh_compress:
	dh_compress -i -X.rst -X.js -X.html -X.txt

override_dh_auto_build:
	python$* setup.py build_sphinx
	set -ex; \
	for python in $(PYVERS) $(PY3VERS); do \
		$$python setup.py build; \
	done

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build *.egg-info __pycache__
	# docs/_build debian/docs
	find \( -name '._*' -o -name '*.pyc' \) -delete

override_dh_auto_install:
	set -ex; \
	for python in $(PYVERS); do \
		$$python setup.py install --skip-build --root $(PYBUILD_DESTDIR_python2) \
			--install-layout deb; \
	done
	rm $(PYBUILD_DESTDIR_python2)usr/bin/versioneer.py

	set -ex; \
	for python in $(PY3VERS); do \
		$$python setup.py install --skip-build --root $(PYBUILD_DESTDIR_python3) \
			--install-layout deb; \
	done
	rm $(PYBUILD_DESTDIR_python3)usr/bin/versioneer.py
	# patch requires.txt file by stripping version information - these are provided by debian depends
	find debian/ -name requires.txt |xargs perl -i -pe "s/(.*)==.*/\1/"