Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 #export DH_VERBOSE=1
3 export PYBUILD_DESTDIR_python3=debian/python3-mypy
4 export PYBUILD_NAME=mypy
5
6 include /usr/share/dpkg/default.mk
7 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
8 export DEB_CFLAGS_MAINT_APPEND += -Wno-misleading-indentation
9
10 ifneq (,$(filter $(DEB_HOST_ARCH),armel armhf mips64el hppa riscv64 mipsel alpha ia64 m68k powerpc sh4 sparc64 hurd-i386 i386 x32 hurd-amd64))
11 export MYPYC_MULTI_FILE=1
12 endif
13 ifneq ($(filter pkg.mypy.multifile,$(DEB_BUILD_PROFILES)),)
14 export MYPYC_MULTI_FILE=1
15 endif
16 export build_MYPYC_DEBUG_LEVEL=2
17 # Why build_MYPY* ? So we don't change how the tests work
18 ifneq ($(filter pkg.mypy.o1,$(DEB_BUILD_PROFILES)),)
19 export build_MYPYC_OPT_LEVEL=1
20 else
21 export build_MYPYC_OPT_LEVEL=3
22 endif
23 ifneq (,$(filter $(DEB_HOST_ARCH),hurd-i386 i386))
24 export build_MYPY_USE_MYPYC=1 # https://github.com/python/mypy/issues/21040
25 else
26 export build_MYPY_USE_MYPYC=1
27 endif
28 export TEST_MYPYC=$(build_MYPY_USE_MYPYC)
29 export MYPY_TEST_PREFIX=$(CURDIR)
30 export PYBUILD_TEST_ARGS=$(DEB_BUILD_OPTION_PARALLEL:%=-n%) \
31 -o python_files=test*.py \
32 -o python_classes= -o python_functions= --pyargs mypy.test mypyc.test \
33 -k 'not (PEP561Suite or testIgnoreImportIfNoPython3StubAvailable or testNoPython3StubAvailable or testCustomTypeshedDirWithRelativePathDoesNotCrash or testDaemonStatusKillRestartRecheck or testOutputJsonParallel or testOutputJsonSyntaxErrorParallel)'
34 # PEP561Suite: needs internet access to pypi.org
35 # testIgnoreImportIfNoPython3StubAvailable: needs scribe installed (it isn't packaged for Debian)
36 # testNoPython3StubAvailable: no longer works because python3-typeshed includes docutils types, which it isn't expecting
37 # testCustomTypeshedDirWithRelativePathDoesNotCrash: fails as the mypy_extensions package is installed, so a different error appears
38 # testDaemonStatusKillRestartRecheck: fails for sbuild/unshare
39 # testOutputJsonParallel: flaky https://github.com/python/mypy/issues/21905
40 # testOutputJsonSyntaxErrorParallel: flaky https://github.com/python/mypy/issues/21905
41
42 %:
43 dh $@ --buildsystem=pybuild
44
45 ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
46 manpages: debian/sphinx/mypy_options.rst debian/sphinx/stubgen_options.rst debian/dmypy.1 debian/mypy.1 debian/stubgen.1
47 else
48 manpages:
49 endif
50
51 debian/%.1: debian/sphinx/%.rst debian/sphinx/%_options.rst
52 sphinx-build -N -b man debian/sphinx debian $<
53
54 # create an empty file to simplify the makefile logic
55 debian/sphinx/dmypy_options.rst:
56 touch $@
57
58 debian/sphinx/mypy_options.rst: docs/source/command_line.rst
59 sed 's,The .* command line,OPTIONS,g' $< > $@
60
61 debian/sphinx/stubgen_options.rst: docs/source/stubgen.rst
62 sed -n -e '/stubgen --help/,$$ {/stubgen --help/d; p}' $< > $@
63
64 override_dh_auto_build-arch:
65 MYPY_USE_MYPYC=$(build_MYPY_USE_MYPYC) \
66 MYPYC_DEBUG_LEVEL=$(build_MYPYC_DEBUG_LEVEL) \
67 MYPYC_OPT_LEVEL=$(build_MYPYC_OPT_LEVEL) \
68 dh_auto_build
69
70 override_dh_auto_build-indep: manpages
71 MYPY_USE_MYPYC=0 dh_auto_build
72 ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
73 PYTHONPATH=$(CURDIR) $(MAKE) -C docs html
74 PYTHONPATH=$(CURDIR) $(MAKE) -C mypyc/doc html
75 mv mypyc/doc/_build/html mypyc/doc/_build/mypyc
76 endif
77
78 execute_after_dh_auto_clean:
79 ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
80 $(MAKE) -C docs clean
81 $(MAKE) -C mypyc/doc clean
82 endif
83
84 execute_after_dh_auto_install:
85 dh_movefiles --package=mypy --sourcedir=debian/python3-mypy usr/bin
86 rm -Rf debian/python3-mypy/usr/bin
87 find debian -name LICENSE -delete
88
89 execute_after_dh_python3:
90 rm -rf debian/python3-mypy/usr/lib/python3/dist-packages/mypyc/doc/
91
92 execute_before_dh_auto_test-arch:
93 ifeq (,$(filter nocheck,$(DEB_BUILD_PROFILES)))
94 PYBUILD_SYSTEM=custom \
95 PYBUILD_TEST_ARGS="{interpreter} -m mypy \
96 --config-file {dir}/mypy_self_check.ini -p mypy" dh_auto_test
97 PYBUILD_SYSTEM=custom \
98 PYBUILD_TEST_ARGS="{interpreter} -m mypy \
99 --config-file {dir}/mypy_self_check.ini -p mypyc" dh_auto_test
100 PYBUILD_SYSTEM=custom \
101 PYBUILD_TEST_ARGS="{interpreter} -m mypy \
102 --config-file {dir}/mypy_self_check.ini setup.py" dh_auto_test
103 endif
104
105 override_dh_auto_test-indep:
106 echo No tests to run for the "mypy" package, only for "python3-mypy"
107
108 download_remote_intersphinx_inventories:
109 curl https://monkeytype.readthedocs.io/en/latest/objects.inv -o debian/intersphinx/monkeytype_objects.inv
110
111 .PHONY: manpages