File: rules

package info (click to toggle)
python-gnocchiclient 7.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 948 kB
  • sloc: python: 3,219; makefile: 36; sh: 26
file content (46 lines) | stat: -rwxr-xr-x 1,906 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

UPSTREAM_GIT=https://github.com/gnocchixyz/python-gnocchiclient.git
include /usr/share/openstack-pkg-tools/pkgos.make

export SETUPTOOLS_SCM_PRETEND_VERSION=$(shell dpkg-parsechangelog -SVersion | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~git.*//' -e 's/~/.0/' -e 's/+dfsg1//' -e 's/+ds1//' | head -n 1)
export PYBUILD_NAME=gnocchiclient

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

override_dh_auto_clean:
	rm -rf build
	find .  -type d -name __pycache__ -exec rm -r {} \+
	dh_auto_clean

override_dh_install:
	dh_install
	# Generate bash completion
	mkdir -p $(CURDIR)/debian/python3-gnocchiclient/usr/share/bash-completion/completions
	PYTHONPATH=$(CURDIR)/.pybuild/cpython3_`py3versions -d -v`_gnocchiclient/build \
		PATH=$(PATH):$(CURDIR)/debian/python3-gnocchiclient/usr/bin \
		gnocchi complete \
		>$(CURDIR)/debian/python3-gnocchiclient/usr/share/bash-completion/completions/gnocchi
	sed -i 's#complete -F _python3_gnocchi python3-gnocchi#complete -F _python3_gnocchi gnocchi#' \
		$(CURDIR)/debian/python3-gnocchiclient/usr/share/bash-completion/completions/gnocchi

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	set -e ; set -x ; for i in $(PYTHON3S) ; do \
		PYTHON=python$$i PYTHONPATH=. python$$i -m pytest gnocchiclient/tests/unit ; \
	done
endif

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	python3 setup.py install --install-layout=deb --root $(CURDIR)/debian/tmp
	export LANG=C.UTF-8 ; export LC_ALL=C.UTF-8 ; set -e ; set -x ; if ! PATH=$$PATH:$(CURDIR)/debian/bin PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages python3 -m sphinx -b html doc/source $(CURDIR)/debian/python-gnocchiclient-doc/usr/share/doc/python-gnocchiclient-doc/html ; then \
		cat /tmp/sphinx-err* ; \
		exit 1 ; \
	fi
	dh_sphinxdoc
endif

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3