1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
#! /usr/bin/make -f
SHELL = /bin/bash
# all versions
PY3VERS := $(shell py3versions -vs)
VER3 := $(shell /usr/bin/python3 -c 'import sys; print(sys.version[:3])')
DEBVERS := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
twversion := $(subst twisted-,,$(notdir $(CURDIR)))
include /usr/share/python3/python.mk
with_docs=
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
with_docs=yes
endif
build: build-stamp
build-arch: build-stamp
build-indep: build-stamp
build-indep: build-stamp build-doc
build-stamp: $(PY3VERS:%=build3-python%)
touch $@
build3-python%:
python$* setup.py build
python$*-dbg setup.py build
touch $@
build-doc:
ifeq ($(with_docs),yes)
$(MAKE) -C docs html
touch $@
endif
clean:
rm -rf *-stamp build tmp
rm -rf docs/_build build-doc
rm -rf build3-python*
rm -rf apidocs py3
rm -rf $(addprefix debian/,$(packages)) debian/files debian/substvars
rm -rf _trial_temp test.log
rm -f twisted/plugins/dropin.cache
find -name '__pycache__' -type d | xargs -r rm -rf
find . -name "*.pyc" |xargs -r rm
dh_clean
install: build-stamp install-prereq $(PY3VERS:%=install3-python%) install-nover
install-prereq: build-stamp
dh_testdir
dh_testroot
dh_prep
install3-python%: install-prereq
: # python3-twisted $*
python$* setup.py install \
--root=$(CURDIR)/debian/python3-twisted --install-layout=deb
find debian/python3-twisted -name '__pycache__' | xargs -r rm -rf
: # python3-twisted-bin
dh_movefiles -ppython3-twisted-bin \
--sourcedir=debian/python3-twisted \
$(call py_libdir,$*)/twisted/test/raiser.cpython-$(subst .,,$*)$(if $(filter 3.7,$*),m)-$(DEB_HOST_MULTIARCH).so
# $(call py_libdir,$*)/twisted/python/sendmsg.cpython-$(subst .,,$*)$(if $(filter 3.7,$*),m)-$(DEB_HOST_MULTIARCH).so
: # Replace all '#!' calls to python with /usr/bin/python3
: # and make them executable
for i in `find debian/python3-twisted debian/python3-twisted-* -mindepth 3 -type f`; do \
sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \
$$i > $$i.temp; \
if cmp --quiet $$i $$i.temp; then \
rm -f $$i.temp; \
else \
mv -f $$i.temp $$i; \
chmod 755 $$i; \
echo "fixed interpreter: $$i"; \
fi; \
done
: # python-twisted-bin-dbg
python$*-dbg setup.py install \
--root=$(CURDIR)/debian/python3-twisted-bin-dbg --no-compile --install-layout=deb
find debian/python3-twisted-bin-dbg ! -type d ! -name '*.so' | xargs rm -f
find debian/python3-twisted-bin-dbg -depth -empty -exec rmdir {} \;
install-nover:
: # python3 man pages
for i in debian/python3-twisted/usr/bin/*; do \
mv $$i $${i}3; \
done
mkdir -p debian/python3-twisted/usr/share/man/man1
for i in docs/core/man/{trial,twistd}.1; do \
i2=$$(basename $$i .1)3.1; \
cp -p $$i debian/python3-twisted/usr/share/man/man1/$$i2; \
done
ifeq ($(with_docs),yes)
: # twisted-doc
mkdir -p debian/twisted-doc/usr/share/doc/twisted-doc
cp -a docs/core/* debian/twisted-doc/usr/share/doc/twisted-doc/
-find debian/twisted-doc -type d -name man | xargs rm -rf
endif
binary-indep: build-indep build-doc install
dh_testdir
dh_testroot
dh_installchangelogs -i
dh_installdocs -i
ifeq ($(with_docs),yes)
cp -a docs/_build/html debian/twisted-doc/usr/share/doc/twisted-doc/.
dh_sphinxdoc -ptwisted-doc
endif
ifeq ($(with_docs),yes)
-cp -ua apidocs debian/twisted-doc/usr/share/doc/twisted-doc/
# Replace links to Twisted website API doc by links to the local doc. We
# need to compute path to the API which goes up enough in the folder
# hierarchy to access the doc.
-[ -d apidocs ] && \
for i in $$(cd debian/twisted-doc/usr/share/doc/twisted-doc/ && \
grep -rl "http://twistedmatrix.com/documents/$(twversion)/api/" .); do \
path="$$(echo $$i | sed "s:[^/]::g" | sed "s:/:../:g" | cut -c 4-)apidocs/"; \
sed -i "s:http\://twistedmatrix.com/documents/$(twversion)/api/:$$path:g" \
debian/twisted-doc/usr/share/doc/twisted-doc/$$i; \
done
endif
dh_installmenu -i
dh_compress -i -X.py
dh_fixperms -i
dh_lintian -i
dh_python3 -i -X hamcrest
# post-process .substvars until #806316 is fixed and -X starts working
sed -i 's/ python3*-hamcrest,//' debian/python3-twisted.substvars
dh_installdeb -i
dh_gencontrol -ptwisted-doc -ppython3-twisted
dh_md5sums -i
dh_builddeb -i
binary-arch: build-arch install
dh_testdir
dh_testroot
dh_installchangelogs -a
dh_lintian -a
dh_installdocs -a
dh_installmenu -a
dh_strip -ppython3-twisted-bin --dbg-package=python3-twisted-bin-dbg
rm -rf debian/python3-twisted-bin-dbg/usr/share/doc/python3-twisted-bin-dbg
ln -s python3-twisted-bin \
debian/python3-twisted-bin-dbg/usr/share/doc/python3-twisted-bin-dbg
dh_compress -a -X.py
dh_fixperms -a
dh_python3 -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install install-nover install-prereq
.NOTPARALLEL:
|