File: rules

package info (click to toggle)
mypy 0.812-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 18,596 kB
  • sloc: python: 74,869; cpp: 11,212; ansic: 3,935; makefile: 238; sh: 13
file content (88 lines) | stat: -rwxr-xr-x 2,554 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
#!/usr/bin/make -f
SHELL=bash  # needed for the <(echo …) process subsitution temporary file
            # tricks with help2man
export DH_VERBOSE=1
export PYBUILD_DESTDIR_python3=debian/python3-mypy
export PYBUILD_NAME=mypy
PY3VERS=$(shell py3versions -vr)

include /usr/share/dpkg/pkg-info.mk
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
	WITH += ,sphinxdoc
endif

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
include /usr/share/dpkg/default.mk
ifneq (,$(filter $(DEB_BUILD_ARCH),hppa))
  export MYPYC_OPT_LEVEL=2
else ifneq (,$(filter $(DEB_BUILD_ARCH),armhf))
  export MYPYC_OPT_LEVEL=1
else ifneq (,$(filter $(DEB_BUILD_ARCH),armel))
  export MYPYC_OPT_LEVEL=0
endif


%:
	dh $@ --with python3$(WITH) --buildsystem=pybuild

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
manpages: debian/dmypy.1 debian/mypy.1 debian/stubgen.1
else
manpages:
endif

debian/%.1: debian/sphinx/%.rst debian/sphinx/%_options.rst
	sphinx-build -N -b man debian/sphinx debian $<

# create an empty file to simplify the makefile logic
debian/sphinx/dmypy_options.rst:
	touch $@

debian/sphinx/mypy_options.rst: docs/source/command_line.rst
	sed 's,The .* command line,OPTIONS,g' $< > $@

debian/sphinx/stubgen_options.rst: docs/source/stubgen.rst
	sed -n -e '/stubgen --help/,$$ {/stubgen --help/d; p}' $< > $@

override_dh_auto_build: manpages
ifneq (,$(filter $(DEB_BUILD_ARCH),mips64el mipsel alpha ia64 m68k powerpc riscv64 sh4 sparc64))
	MYPY_USE_MYPYC=0 dh_auto_build
else
	MYPY_USE_MYPYC=1 dh_auto_build
endif
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
	PYTHONPATH=$(CURDIR) $(MAKE) -C docs html
endif

override_dh_auto_clean:
	dh_auto_clean
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
	$(MAKE) -C docs clean
	rm -rf debian/.doctrees
	rm -f  debian/sphinx/dmypy_options.rst
	rm -f  debian/sphinx/mypy_options.rst
	rm -f  debian/sphinx/stubgen_options.rst
endif

override_dh_auto_install:
	dh_auto_install
	dh_movefiles --package=mypy --sourcedir=debian/python3-mypy usr/bin
	rm -Rf debian/python3-mypy/usr/bin

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_PROFILES)))
	export TEST_MYPYC=1
	# PYBUILD_SYSTEM=custom \
	# 	PYBUILD_TEST_ARGS="{interpreter} -m mypy \
	# 	--config-file {dir}/mypy_self_check.ini -p mypy" dh_auto_test
	# ^^^ requires pytest > 6.0.0
	dh_auto_install
	set -e; for v in $(PY3VERS); do \
		PATH=$$PATH:$(CURDIR)/debian/mypy/usr/bin/ python$$v -m pytest -n auto \
		-o testpaths=mypy/test -o python_files=test*.py \
		-k "not StubtestMiscUnit" \
		-o python_classes= -o python_functions=; \
	done
endif

.PHONY: manpages