| 1 | #!/usr/bin/make -f |
| 2 | # -*- makefile -*- |
| 3 | |
| 4 | # Uncomment this to turn on verbose mode. |
| 5 | #export DH_VERBOSE=1 |
| 6 | |
| 7 | SHELL = /bin/bash |
| 8 | |
| 9 | export PYBUILD_NAME=twisted |
| 10 | # Don't do any testing while build, it's done within autopkgtesting. |
| 11 | export PYBUILD_DISABLE=test |
| 12 | export PYBUILD_AFTER_INSTALL=rm -rf {destdir}/usr/lib/python3*/dist-packages/twisted/internet/iocpreactor/notes.txt |
| 13 | |
| 14 | %: |
| 15 | dh $@ --buildsystem=pybuild |
| 16 | |
| 17 | execute_before_dh_clean: |
| 18 | rm -rf *-stamp build tmp |
| 19 | rm -rf docs/_build build-doc |
| 20 | rm -rf build3-python* |
| 21 | rm -rf $(addprefix debian/,$(packages)) debian/files debian/substvars |
| 22 | rm -rf _trial_temp test.log |
| 23 | rm -f twisted/plugins/dropin.cache |
| 24 | find -name '__pycache__' -type d | xargs -r rm -rf |
| 25 | find . -name "*.pyc" |xargs -r rm |
| 26 | |
| 27 | override_dh_sphinxdoc: |
| 28 | ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS))) |
| 29 | PYTHONPATH=src python3 -m sphinx -b html -N docs/ $(CURDIR)/debian/twisted-doc/usr/share/doc/twisted-doc/html |
| 30 | dh_sphinxdoc |
| 31 | cp -a docs/core/* debian/twisted-doc/usr/share/doc/twisted-doc/ |
| 32 | -find debian/twisted-doc -type d -name man | xargs rm -rf |
| 33 | # Replace all '#!' calls to python with /usr/bin/python3 and make them |
| 34 | # NON executable. |
| 35 | for i in `find debian/twisted-doc -mindepth 3 -type f`; do \ |
| 36 | sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \ |
| 37 | $${i} > $${i}.temp; \ |
| 38 | if cmp --quiet $${i} $${i}.temp; then \ |
| 39 | rm -f $${i}.temp; \ |
| 40 | else \ |
| 41 | mv -f $${i}.temp $${i}; \ |
| 42 | chmod 644 $${i}; \ |
| 43 | echo "fixed interpreter: $${i}"; \ |
| 44 | fi; \ |
| 45 | done |
| 46 | endif |
| 47 | |
| 48 | execute_after_dh_auto_install: |
| 49 | find debian/python3-twisted -name '__pycache__' | xargs -r rm -rf |
| 50 | find debian/python3-twisted -name .gitignore -delete |
| 51 | # Replace all '#!' calls to python with /usr/bin/python3 and make them |
| 52 | # executable. |
| 53 | for i in `find debian/python3-twisted -mindepth 3 -type f`; do \ |
| 54 | sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \ |
| 55 | $${i} > $${i}.temp; \ |
| 56 | if cmp --quiet $${i} $${i}.temp; then \ |
| 57 | rm -f $${i}.temp; \ |
| 58 | else \ |
| 59 | mv -f $${i}.temp $${i}; \ |
| 60 | chmod 755 $${i}; \ |
| 61 | echo "fixed interpreter: $${i}"; \ |
| 62 | fi; \ |
| 63 | done |
| 64 | # Tune Python3 man pages. |
| 65 | for i in debian/python3-twisted/usr/bin/*; do \ |
| 66 | mv $${i} $${i}3; \ |
| 67 | done |
| 68 | mkdir -p debian/python3-twisted/usr/share/man/man1 |
| 69 | for i in docs/core/man/{trial,twistd}.1; do \ |
| 70 | i2=$$(basename $${i} .1)3.1; \ |
| 71 | cp -p $${i} debian/python3-twisted/usr/share/man/man1/$${i2}; \ |
| 72 | done |
| 73 | |
| 74 | override_dh_compress: |
| 75 | # Don't compress an Python files. Especially not in twisted-doc. |
| 76 | dh_compress -i -X.py |