~sylvain-pineau/checkbox/lsb_release_dep

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
#!/usr/bin/make -f

#export DH_VERBOSE=1

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

REL_NO	:= $(shell lsb_release -rs)
RELEASE_GTE_RARING	:= $(shell expr $(REL_NO) \>= 13.04)

%:
	dh "$@" --with python3,sphinxdoc,translations

override_dh_auto_clean:
	rm -rf $(CURDIR)/plainbox/build
	rm -rf $(CURDIR)/plainbox/*.egg-info
	rm -rf $(CURDIR)/checkbox/build
	rm -rf $(CURDIR)/checkbox/*.egg-info
	rm -rf $(CURDIR)/checkbox-ng/build
	rm -rf $(CURDIR)/checkbox-ng/*.egg-info
	rm -rf $(CURDIR)/checkbox-ng/*.egg-link
	rm -rf $(CURDIR)/plainbox-provider*/*.egg-info
	-find . -name \*.mo -exec rm {} \;
	-rm -f debian/checkbox-cli.postrm debian/checkbox-qt.postrm debian/checkbox-hw-collection.postrm
	debconf-updatepo
	dh_clean

override_dh_auto_build:
ifeq (1,$(RELEASE_GTE_RARING))
	# funcsigs.Signature (the backport) is part of the Python standard library,
	# available as inspect.Signature in Python 3.3 onwards.
	rm -rf $(CURDIR)/plainbox/plainbox/vendor/funcsigs
	# mock is now part of the Python standard library, available as
	# unittest.mock in Python 3.3 onwards.
	echo "from unittest.mock import *" > $(CURDIR)/plainbox/plainbox/vendor/mock.py
	dh_quilt_patch
endif
	python3 setup.py build

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	# drop LD_PRELOAD to avoid running under fakeroot; drop TMPDIR to work
	# around LP#972324 (set by autopkgtest)
	cd $(CURDIR)/checkbox-old && env -u LD_PRELOAD -u TMPDIR CHECKBOX_PACKAGING=1 ./setup.py test -vv
	rm -rf  $(CURDIR)/checkbox-old/scripts/__pycache__
	cd $(CURDIR)/plainbox && ./setup.py test -vv
	# checkbox-ng requires plainbox to be installed, let's just use the develop
	# mode and create an egg-link to the plainbox source
	cd $(CURDIR)/plainbox && PYTHONPATH=$(CURDIR)/checkbox-ng ./setup.py develop -d $(CURDIR)/checkbox-ng
	cd $(CURDIR)/checkbox-ng && ./setup.py test -vv
endif

override_dh_auto_install:
	python3 setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
	mkdir -p $(CURDIR)/debian/tmp/usr/lib/checkbox/bin/
	cp -R $(CURDIR)/debian/tmp/usr/share/checkbox/scripts/* $(CURDIR)/debian/tmp/usr/lib/checkbox/bin/
	dh_install

override_dh_installdocs:
	# This is tricky, dh_installdirs installs stuff to the first package in
	# debian/control, ensure that's the -doc package.
	cd $(CURDIR)/plainbox && ./setup.py build_sphinx
	dh_installdocs $(CURDIR)/plainbox/build/sphinx/html/
	dh_installdocs -pcheckbox ./checkbox-old/README
	dh_installdocs -pcheckbox-cli ./checkbox-old/README
	dh_installdocs -pcheckbox-qt ./checkbox-old/README
	dh_installdocs -pcheckbox-hw-collection ./checkbox-old/README
	dh_installdocs

override_dh_python3:
	# dh_python3 runs automatically on packages with the python3- prefix
	# let's not forget plainbox
	dh_python3 --package=plainbox
	dh_python3

override_dh_installdeb:
	cp debian/checkbox.postrm debian/checkbox-cli.postrm
	cp debian/checkbox.postrm debian/checkbox-qt.postrm
	cp debian/checkbox.postrm debian/checkbox-hw-collection.postrm
	dh_installdeb