File: rules

package info (click to toggle)
python-ptk 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 388 kB
  • ctags: 928
  • sloc: python: 3,427; makefile: 211
file content (42 lines) | stat: -rwxr-xr-x 1,556 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
#!/usr/bin/make -f

# See https://wiki.debian.org/Python/LibraryStyleGuide.

POLICY_TARGETS := binary binary-arch binary-indep build build-arch \
  build-indep clean
.PHONY: $(POLICY_TARGETS)
$(POLICY_TARGETS):
	dh $@ --with=python2,python3,sphinxdoc

# ptk/async_*.py files contain the "async def" syntax, causing a
# compilation error for versions << 3.5.
PYBUILD_TARGETS := $(addprefix override_dh_auto_,configure build test install)
.PHONY: $(PYBUILD_TARGETS)
$(PYBUILD_TARGETS): override_dh_auto_%:
	mv ptk/async_*.py debian
	pybuild --$* --name=ptk --pyver="`pyversions -vr`" $(PYBUILD_ARGS)
	mv debian/async_*.py ptk
	pybuild --$* --name=ptk --pyver="`py3versions -vr`" $(PYBUILD_ARGS)

# README.rst and html are also mentioned in python-ptk-doc.doc*.
override_dh_auto_build: README.rst html
README.rst:
	$(MAKE) prepare
# Forbid internet access.
# Select Python3, able to parse async def in imported Python modules.
html:
	PYTHONPATH=. http_proxy='127.0.0.1:9' $(MAKE) documentation \
	  SPHINXBUILD=/usr/share/sphinx/scripts/python3/sphinx-build

# Discover requires an explicit start-directory to find anything.
# Only run test_all.py, which skips twisted if it is not installed.
override_dh_auto_test: PYBUILD_ARGS := \
  "--test-args=--start-directory=tests --pattern=test_all.py"

# Avoid pybuild when cleaning, as it creates subdirectories.
.PHONY: override_dh_auto_clean
override_dh_auto_clean:
  # Versions > 1.2.0 should leave no doc/html in the way anymore.
	rm -fr .pybuild doc/build html
	rm -f README.rst
	find . -name "*.pyc" -delete