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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
|
#!/usr/bin/make -f
# -*-Makefile-*-
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Cristoph Lameter.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEFAULT_PYTHON := $(shell pyversions -d)
VERSIONS := $(shell pyversions -vs)
dest_xbel := debian/xbel
dest_xbel_utils := debian/xbel-utils
doc_xbel := $(dest_xbel)/usr/share/doc/xbel
doc_xbel_utils := $(dest_xbel_utils)/usr/share/doc/xbel-utils
debian_patches=
build: stamp-build
stamp-build: $(VERSIONS:%=stamp-build-%)
touch $@
stamp-build-%: patched-stamp
dh_testdir
python$* setup.py build --without-xslt
cp doc/man/xmlproc_parse.1 doc/man/xmlproc_parse.python$*-xml.1
cp doc/man/xmlproc_val.1 doc/man/xmlproc_val.python$*-xml.1
python$*-dbg setup.py build --without-xslt
touch $@
clean: reverse-patches
dh_testdir
dh_testroot
rm -f stamp-*
rm -rf build dist
rm -f doc/man/xmlproc_*.python2.?-xml.1
find . -name "*.py[co]" -exec rm -f {} \;
rm -f debian/man/index.bt
dh_clean
# Build architecture-independent files here.
binary-indep:
dh_testdir -i
dh_testroot -i
dh_clean -k -i
dh_installdirs -i
# xbel
install -m 0644 demo/xbel/doc/* $(doc_xbel)
install -m 0644 demo/xbel/README $(doc_xbel)
install -m 0644 demo/xbel/*.dtd $(dest_xbel)/usr/share/sgml/dtd
ln -s ../../dtd/xbel-1.0.dtd \
$(dest_xbel)/usr/share/sgml/IDN_python.org/dtd/XML_Bookmark_Exchange_Language_1.0
ln -s ../../dtd/xbel-1.1.dtd \
$(dest_xbel)/usr/share/sgml/IDN_python.org/dtd/XML_Bookmark_Exchange_Language_1.1
install -m 0644 debian/xbel.sgml-catalog $(dest_xbel)/usr/share/sgml/misc/xbel/xbel.cat
# xbel_utils
install -m 0644 demo/xbel/README $(doc_xbel_utils)
mkdir -p $(dest_xbel_utils)/usr/lib/$(DEFAULT_PYTHON)/site-packages/_xmlplus/xbel
install -m 0644 demo/xbel/*.py \
$(dest_xbel_utils)/usr/lib/$(DEFAULT_PYTHON)/site-packages/_xmlplus/xbel
touch $(dest_xbel_utils)/usr/lib/$(DEFAULT_PYTHON)/site-packages/_xmlplus/xbel/__init__.py
set -e; \
cd $(dest_xbel_utils) && \
for i in `find -type f`; do \
if head -1 $$i | grep "^#! */usr/bin" | grep "python" >/dev/null ; then \
sed "s%#! */usr/bin/env \+python.*$\%#! /usr/bin/python%" <$$i >$$i.temp; \
mv $$i.temp $$i; \
chmod +x $$i; \
fi; \
done
for i in adr_parse lynx_parse msie_parse ns_parse xbel2html xbel_parse ; do \
( \
echo "#! /bin/sh"; \
echo "ver=\$$(/usr/bin/python -c 'import sys; print sys.version[:3]')"; \
echo "exec /usr/bin/python /usr/lib/python\$$ver/site-packages/_xmlplus/xbel/$$i.py \"\$$@\""; \
) > $(dest_xbel_utils)/usr/bin/$$i; \
done
# python-xml-doc
mkdir -p debian/python-xml-doc/usr/share/doc/python-xml
mkdir -p debian/python-xml-doc/usr/share/doc/python-xml-doc
cp -R doc/* debian/python-xml-doc/usr/share/doc/python-xml/
rm -rf debian/python-xml-doc/usr/share/doc/python-xml/man
rm -rf debian/python-xml-doc/usr/share/doc/python-xml/*.tex
cp -r demo/* debian/python-xml-doc/usr/share/doc/python-xml/examples/demo/
cp -r test/* debian/python-xml-doc/usr/share/doc/python-xml/examples/test/
rm -rf debian/python-xml-doc/usr/share/doc/python-xml/examples/demo/xbel
for i in debian/python-xml-doc/usr/share/doc/python-xml/*; do \
b=$$(basename $$i); \
ln -sf ../python-xml/$$b debian/python-xml-doc/usr/share/doc/python-xml-doc/$$b; \
done
: # Replace all '#!' calls to python with /usr/bin/python
: # and make them executable
for i in `find debian/python-xml-doc -type f`; do \
sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\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
dh_pycentral -i
dh_installdocs -i
dh_installman -pxbel-utils
dh_installchangelogs -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build
dh_testdir -a
dh_testroot -a
dh_clean -k -a
dh_installdirs -a
for version in $(VERSIONS) ; do \
PYTHON=python$${version} ; \
PACKAGE=python-xml ;\
DESTDIR=debian/$${PACKAGE} ;\
SITE_PACK=$${DESTDIR}/usr/lib/$${PYTHON}/site-packages/_xmlplus ;\
$${PYTHON} setup.py install \
--without-xslt --no-compile --prefix=$${DESTDIR}/usr ;\
chmod 755 $${SITE_PACK}/dom/html/GenerateHtml.py ;\
rm $${DOC}/examples/demo/sgmlop/test2.htm ;\
tail -n +2 $${SITE_PACK}/dom/ext/c14n.py > $${SITE_PACK}/dom/ext/c14n.py.new ;\
mv $${SITE_PACK}/dom/ext/c14n.py.new $${SITE_PACK}/dom/ext/c14n.py ;\
for i in `find $${DESTDIR} -type f`; do \
if head -1 $$i | grep "^#! */usr/bin" | grep "python" >/dev/null ; then \
sed -i 's@^\(#! */usr/bin/env \+\)python[.[:digit:]]*$$@\1'$${PYTHON}'@;s@^\(#! */usr/bin/\)python[.[:digit:]]*$$@\1'$${PYTHON}'@' $$i; \
fi ;\
done ;\
mv $${DESTDIR}/usr/bin/xmlproc_parse \
$${DESTDIR}/usr/bin/xmlproc_parse.$${PACKAGE} ;\
mv $${DESTDIR}/usr/bin/xmlproc_val \
$${DESTDIR}/usr/bin/xmlproc_val.$${PACKAGE} ;\
done
: # Replace all '#!' calls to python with /usr/bin/python
: # and make them executable
for i in `find debian -mindepth 3 -type f`; do \
sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\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
for version in $(VERSIONS) ; do \
PYTHON=python$${version} ; \
PACKAGE=python-xml-dbg ;\
DESTDIR=debian/$${PACKAGE} ;\
SITE_PACK=$${DESTDIR}/usr/lib/$${PYTHON}/site-packages/_xmlplus ;\
DOC=$${DESTDIR}/usr/share/doc/$${PACKAGE} ;\
$${PYTHON}-dbg setup.py \
install --without-xslt --no-compile --prefix=$${DESTDIR}/usr ;\
done
find debian/python-xml-dbg ! -type d ! \( -name '*_d.so' -o -name '*.h' \) \
| xargs rm -f
find debian/python-xml-dbg -depth -empty -exec rmdir {} \;
dh_pycentral -a
dh_installdocs -a
dh_installmenu -a
dh_installman -a
dh_installchangelogs -a ANNOUNCE
rm -rf debian/python-xml-dbg/usr/share/doc/python-xml-dbg
ln -s python-xml debian/python-xml-dbg/usr/share/doc/python-xml-dbg
dh_strip -ppython-xml --dbg-package=python-xml-dbg
dh_compress -a
dh_fixperms -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
# ---------------------------------------------------------------------------
# Various rules to unpack addons and (un)apply patches.
# Borrowed from DBS
patch_dir = debian/patches
apply-patches: patched-stamp
reverse-patches:
@for stamp in none patched-*; do \
case "$$stamp" in none|patched-stamp|patched-\*) continue; esac; \
patch=`echo $$stamp | sed -e 's/patched-//'`; \
echo "trying to revert patch $$patch ..."; \
if [ -x $(patch_dir)/$$patch.dpatch ]; then true; else \
chmod +x $(patch_dir)/$$patch.dpatch; fi; \
if $(patch_dir)/$$patch.dpatch -unpatch; then \
echo "reverted $$patch patch."; \
rm -f $$stamp; \
else \
echo "error in reverting $$patch patch."; \
exit 1; \
fi; \
done
@echo "Removing patched-stamp"
@rm -f patched-stamp
patched-%: $(patch_dir)/%.dpatch
@if [ -x $< ]; then true; else chmod +x $<; fi
@if [ -f $@ ]; then \
echo "$* patches already applied. $< $@"; exit 1; \
fi
$< -patch
@echo "$* patches applied." > $@
patched-stamp: $(foreach p,$(debian_patches),patched-$(p))
@echo -e "\nPatches applied:" >> pxxx
@for i in none $(debian_patches); do \
if [ -r debian/patches/$$i.dpatch ]; then \
printf "\n$$i:\n" >> pxxx; \
sed -n 's/^# *DP: */ /p' debian/patches/$$i.dpatch >> pxxx; \
fi \
done
@echo "Writing patched-stamp"
@mv -f pxxx patched-stamp
|