| 1 | #! /usr/bin/make -f |
| 2 | export DH_VERBOSE=1 |
| 3 | |
| 4 | include /usr/share/dpkg/pkg-info.mk |
| 5 | |
| 6 | prebuilt_version = $(shell cat debian/prebuilt/version) |
| 7 | ifneq ($(DEB_VERSION_UPSTREAM:+dfsg=), $(prebuilt_version)) |
| 8 | $(error Please run ./debian/prebuilt/update.sh to update CSS for the new version.) |
| 9 | endif |
| 10 | |
| 11 | # intentionally break networking, as using it is against policy and nodeenv/npm may try to download modules |
| 12 | export http_proxy=http://127.0.0.1:9/ |
| 13 | export https_proxy=http://127.0.0.1:9/ |
| 14 | |
| 15 | export PYBUILD_BEFORE_TEST=cp -r src/pydata_sphinx_theme {build_dir} |
| 16 | export PYBUILD_TEST_ARGS=-v |
| 17 | export PYBUILD_NAME=pydata-sphinx-theme |
| 18 | |
| 19 | %: |
| 20 | dh $@ --buildsystem=pybuild |
| 21 | |
| 22 | execute_before_dh_auto_build: |
| 23 | pybabel compile -d $(CURDIR)/src/pydata_sphinx_theme/locale -D sphinx |
| 24 | ln -sf /usr/share/node_modules . |
| 25 | webpack |
| 26 | cp -a debian/prebuilt/styles src/pydata_sphinx_theme/theme/pydata_sphinx_theme/static/ |
| 27 | |
| 28 | ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) |
| 29 | execute_after_dh_auto_build: |
| 30 | PYTHONPATH=$(CURDIR)/src sphinx-build -N -E -T -b html $(CURDIR)/docs $(CURDIR)/.pybuild/docs/html |
| 31 | rm -rf $(CURDIR)/.pybuild/docs/html/.doctrees |
| 32 | |
| 33 | theme_static=/usr/lib/python3/dist-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/static |
| 34 | docs_static=$(CURDIR)/debian/python-pydata-sphinx-theme-doc/usr/share/doc/python-pydata-sphinx-theme-doc/html/_static |
| 35 | |
| 36 | execute_before_dh_link: |
| 37 | set -eu; cd $(CURDIR)/debian/python3-pydata-sphinx-theme$(theme_static); find -type f -or -type l | while read f; do \ |
| 38 | if cmp -s $$f $(docs_static)/$$f; then \ |
| 39 | ln -sfv $(theme_static)/$$f $(docs_static)/$$f; \ |
| 40 | fi \ |
| 41 | done |
| 42 | |
| 43 | override_dh_compress: |
| 44 | dh_compress -Xpython-pydata-sphinx-theme-doc/html |
| 45 | |
| 46 | # Fixe privacy-breach-generic |
| 47 | execute_after_dh_installdocs: |
| 48 | find debian/python-pydata-sphinx-theme-doc/usr/share/doc/python-pydata-sphinx-theme-doc/html/ \ |
| 49 | -name "*.html" | xargs sed -i \ |
| 50 | 's|https://picsum\.photos/[^"]*|_static/theme-demo-screenshot.png|g' |
| 51 | |
| 52 | endif |