| 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 |
self_test_joblimit := $(or $(DEB_BUILD_OPTION_PARALLEL),1) |
| 31 |
ifneq (,$(filter $(DEB_HOST_ARCH),riscv64)) |
| 32 |
self_test_joblimit=0 |
| 33 |
riscv_no_test= or testShadowFileWithNativeParserParallel or testPackageRootMultipleParallel or testParallelRunWithSyntaxError or testCheckingStubPackagesWorksInParallelMode |
| 34 |
endif |
| 35 |
# riscv test failures: https://github.com/python/mypy/issues/21969 |
| 36 |
export PYBUILD_TEST_ARGS=$(DEB_BUILD_OPTION_PARALLEL:%=-n%) \ |
| 37 |
-o python_files=test*.py \ |
| 38 |
-o python_classes= -o python_functions= --pyargs mypy.test mypyc.test \ |
| 39 |
-k 'not (PEP561Suite or testIgnoreImportIfNoPython3StubAvailable or testNoPython3StubAvailable or testCustomTypeshedDirWithRelativePathDoesNotCrash or testDaemonStatusKillRestartRecheck or testOutputJsonParallel or testOutputJsonSyntaxErrorParallel $(riscv_no_test))' |
| 40 |
# PEP561Suite: needs internet access to pypi.org |
| 41 |
# testIgnoreImportIfNoPython3StubAvailable: needs scribe installed (it isn't packaged for Debian) |
| 42 |
# testNoPython3StubAvailable: no longer works because python3-typeshed includes docutils types, which it isn't expecting |
| 43 |
# testCustomTypeshedDirWithRelativePathDoesNotCrash: fails as the mypy_extensions package is installed, so a different error appears |
| 44 |
# testDaemonStatusKillRestartRecheck: fails for sbuild/unshare |
| 45 |
# testOutputJsonParallel: flaky https://github.com/python/mypy/issues/21905 |
| 46 |
# testOutputJsonSyntaxErrorParallel: flaky https://github.com/python/mypy/issues/21905 |
| 47 |
|
| 48 |
|
| 49 |
%: |
| 50 |
dh $@ --buildsystem=pybuild |
| 51 |
|
| 52 |
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES))) |
| 53 |
manpages: debian/sphinx/mypy_options.rst debian/sphinx/stubgen_options.rst debian/dmypy.1 debian/mypy.1 debian/stubgen.1 |
| 54 |
else |
| 55 |
manpages: |
| 56 |
endif |
| 57 |
|
| 58 |
debian/%.1: debian/sphinx/%.rst debian/sphinx/%_options.rst |
| 59 |
sphinx-build -N -b man debian/sphinx debian $< |
| 60 |
|
| 61 |
# create an empty file to simplify the makefile logic |
| 62 |
debian/sphinx/dmypy_options.rst: |
| 63 |
touch $@ |
| 64 |
|
| 65 |
debian/sphinx/mypy_options.rst: docs/source/command_line.rst |
| 66 |
sed 's,The .* command line,OPTIONS,g' $< > $@ |
| 67 |
|
| 68 |
debian/sphinx/stubgen_options.rst: docs/source/stubgen.rst |
| 69 |
sed -n -e '/stubgen --help/,$$ {/stubgen --help/d; p}' $< > $@ |
| 70 |
|
| 71 |
override_dh_auto_build-arch: |
| 72 |
MYPY_USE_MYPYC=$(build_MYPY_USE_MYPYC) \ |
| 73 |
MYPYC_DEBUG_LEVEL=$(build_MYPYC_DEBUG_LEVEL) \ |
| 74 |
MYPYC_OPT_LEVEL=$(build_MYPYC_OPT_LEVEL) \ |
| 75 |
dh_auto_build |
| 76 |
|
| 77 |
override_dh_auto_build-indep: manpages |
| 78 |
MYPY_USE_MYPYC=0 dh_auto_build |
| 79 |
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES))) |
| 80 |
PYTHONPATH=$(CURDIR) $(MAKE) -C docs html |
| 81 |
PYTHONPATH=$(CURDIR) $(MAKE) -C mypyc/doc html |
| 82 |
mv mypyc/doc/_build/html mypyc/doc/_build/mypyc |
| 83 |
endif |
| 84 |
|
| 85 |
execute_after_dh_auto_clean: |
| 86 |
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES))) |
| 87 |
$(MAKE) -C docs clean |
| 88 |
$(MAKE) -C mypyc/doc clean |
| 89 |
endif |
| 90 |
|
| 91 |
execute_after_dh_auto_install: |
| 92 |
dh_movefiles --package=mypy --sourcedir=debian/python3-mypy usr/bin |
| 93 |
rm -Rf debian/python3-mypy/usr/bin |
| 94 |
find debian -name LICENSE -delete |
| 95 |
|
| 96 |
execute_after_dh_python3: |
| 97 |
rm -rf debian/python3-mypy/usr/lib/python3/dist-packages/mypyc/doc/ |
| 98 |
|
| 99 |
execute_before_dh_auto_test-arch: |
| 100 |
ifeq (,$(filter nocheck,$(DEB_BUILD_PROFILES))) |
| 101 |
PYBUILD_SYSTEM=custom \ |
| 102 |
PYBUILD_TEST_ARGS="{interpreter} -m mypy \ |
| 103 |
--config-file {dir}/mypy_self_check.ini \ |
| 104 |
--num-workers $(self_test_joblimit) -p mypy" dh_auto_test |
| 105 |
PYBUILD_SYSTEM=custom \ |
| 106 |
PYBUILD_TEST_ARGS="{interpreter} -m mypy \ |
| 107 |
--num-workers $(self_test_joblimit) \ |
| 108 |
--config-file {dir}/mypy_self_check.ini -p mypyc" dh_auto_test |
| 109 |
PYBUILD_SYSTEM=custom \ |
| 110 |
PYBUILD_TEST_ARGS="{interpreter} -m mypy \ |
| 111 |
--num-workers $(self_test_joblimit) \ |
| 112 |
--config-file {dir}/mypy_self_check.ini setup.py" dh_auto_test |
| 113 |
endif |
| 114 |
|
| 115 |
override_dh_auto_test-indep: |
| 116 |
echo No tests to run for the "mypy" package, only for "python3-mypy" |
| 117 |
|
| 118 |
download_remote_intersphinx_inventories: |
| 119 |
curl https://monkeytype.readthedocs.io/en/latest/objects.inv -o debian/intersphinx/monkeytype_objects.inv |
| 120 |
|
| 121 |
.PHONY: manpages |