Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 include /usr/share/dpkg/buildopts.mk
4 include /usr/share/dpkg/pkg-info.mk
5 export SETUPTOOLS_SCM_PRETEND_VERSION=${DEB_VERSION_UPSTREAM}
6
7 export XDG_RUNTIME_DIR=/tmp
8
9 PY3VERS := $(shell py3versions -v -s)
10 PY3DEF := $(shell py3versions -v -d)
11 pdata := python-matplotlib-data
12 p3 := python3-matplotlib
13
14 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
15 export PYBUILD_BUILD_ARGS := -Csetup-args=-Dsystem-freetype=true -Csetup-args=-Dsystem-qhull=true
16 export PYBUILD_BEFORE_TEST=cp -a {dir}/lib/matplotlib/tests/baseline_images {build_dir}/matplotlib/tests/ && \
17 cp -a {dir}/lib/matplotlib/tests/tinypages {build_dir}/matplotlib/tests/ && \
18 cp -a {dir}/lib/matplotlib/tests/mpltest.ttf {build_dir}/matplotlib/tests/ && \
19 cp -a {dir}/lib/mpl_toolkits/mplot3d/tests/baseline_images {build_dir}/mpl_toolkits/mplot3d/tests/ && \
20 cp -a {dir}/lib/mpl_toolkits/axes_grid1/tests/baseline_images {build_dir}/mpl_toolkits/axes_grid1/tests/ && \
21 cp -a {dir}/lib/mpl_toolkits/axisartist/tests/baseline_images {build_dir}/mpl_toolkits/axisartist/tests/
22
23 # https://bugs.debian.org/1000435
24 # it is due to a bug of gcc-11
25 ifneq (,$(filter $(DEB_HOST_ARCH), mips64 mips64el mips64r6 mips64r6el))
26 DEB_CFLAGS_MAINT_APPEND += -O3
27 DEB_CXXFLAGS_MAINT_APPEND += -O3
28 endif
29
30 DPKG_EXPORT_BUILDFLAGS = 1
31 include /usr/share/dpkg/buildflags.mk
32
33 %:
34 dh $@ --buildsystem=pybuild --with python3,numpy3,sphinxdoc
35
36 ifeq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
37 execute_before_dh_installdocs-indep:
38 # build the doc
39 MPLCONFIGDIR=. MATPLOTLIBDATA=$(CURDIR)/lib/matplotlib/mpl-data/ PYTHONPATH=$$(pybuild --print build_dir --interpreter python$(PY3DEF)) \
40 HOME=/tmp xvfb-run -a $(MAKE) -C doc html
41 endif
42
43 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
44 override_dh_auto_test-indep:
45
46 execute_before_dh_auto_test-arch:
47 echo "backend : TkAgg" > matplotlibrc
48
49 execute_after_dh_auto_test-arch:
50 rm matplotlibrc
51
52 # the "not" tests are due to https://github.com/matplotlib/matplotlib/issues/24770
53 # and 2025-01-29 attempt fix FTBFS as part of numpy2/python3.13 transitions
54 override_dh_auto_test-arch: export PYBUILD_TEST_ARGS=-n $(DEB_BUILD_OPTION_PARALLEL) -v --ignore-glob=*/test_backend_nbagg.py -k 'not test_fig_close and not test_fig_sigint_override and not test_correct_key and not test_device_pixel_ratio_change and not test_subplottool and not test_figureoptions and not test_double_resize and not test_canvas_reinit and not test_form_widget_get_with_datetime_and_date_fields and not test_span_selector_animated_artists_callback and not test_normal_axes and not test_rcupdate and not test_unicode_won and not test_lazy_auto_backend_selection and not test_webagg and not test_bbox_inches_tight_suptile_legend[png] and not test_bbox_inches_tight_suptitle_non_default[png] and not test_hidden_axes and not test_compressed1 and not test_auto_date_locator_intmult_tz and not test_DateLocator and not test_figure_legend_outside and not test_warn_big_data_best_loc and not test_tmpconfigdir_warning and not test_importable_with_no_home and not test_get_tightbbox_polar and not test_backend_fallback_headful and not test_outward_ticks and not test_image_grid_single_bottom[png] and not test_sphinx_gallery_example_header and not test_interactive_backend and not test_interactive_thread_safety and not test_blitting_events and not test_sigint and not test_other_signal_before_sigint and not test_interactive_timers and not test_savefig_to_stringio and not test_psd_csd and not test_overprecision and not test_Type1Font_2 and not test_Type1Font and not test_ft2font_get_kerning and not test_ipython and not test_lazy_linux_headless and not test_determinism_check and not test_norm_callback and not test_show_source_link_false and not test_lockfilefailure'
55 override_dh_auto_test-arch: export MATPLOTLIBDATA=$(CURDIR)/lib/matplotlib/mpl-data/
56 override_dh_auto_test-arch: export MPLCONFIGDIR=$(CURDIR)
57 override_dh_auto_test-arch:
58 -dh_auto_test
59 endif
60
61 execute_after_dh_install-indep:
62 rm -fr $(CURDIR)/debian/$(pdata)/usr/share/matplotlib/mpl-data/fonts/ttf/Vera*.ttf
63 rm -fr $(CURDIR)/debian/$(pdata)/usr/share/matplotlib/mpl-data/fonts/ttf/*.TXT
64 rm -fr $(CURDIR)/debian/$(pdata)/usr/share/matplotlib/mpl-data/fonts/ttf/local.conf
65 rm -fr $(CURDIR)/debian/$(pdata)/usr/share/matplotlib/mpl-data/fonts/pdfcorefonts/readme.txt
66 chmod 644 $(CURDIR)/debian/$(pdata)/usr/share/matplotlib/mpl-data/images/*.svg
67
68 execute_after_dh_install-arch:
69 # scrub some test output that should not be in the module
70 rm -rf $(CURDIR)/debian/python3-matplotlib/usr/lib/python*/dist-packages/result_images/
71 # make python scripts starting with '#!' executable
72 for i in `find debian -mindepth 2 -type f ! -perm 755`; do \
73 if head -1 $$i | grep -q '^#!'; then \
74 chmod 755 $$i; \
75 echo "made executable: $$i"; \
76 fi; \
77 done
78 find debian/ -name '*.pyc' -delete
79 find debian/ -name '__pycache__' -exec rm -rf {} +
80 find debian/ -name '.eslintrc.js' -delete
81 find debian/ -name '.gitignore' -delete
82
83 # FIXME: is it possible to omit baseline_images and bring it in only
84 # for CI tests
85 rm -rf $(CURDIR)/debian/$(p3)/usr/lib/python*/dist-packages/matplotlib/mpl-data/
86 rm -rf $(CURDIR)/debian/$(p3)/usr/lib/python*/dist-packages/matplotlib/backends/Matplotlib.nib/
87
88 execute_before_dh_missing:
89 find debian/tmp -type d \( -name "result_images" -o -name ".pytest_cache" \) -exec rm -rf {} \; || true