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
|
#!/usr/bin/make -f
export DH_VERBOSE=1
%:
PATH="$$PATH:$(CURDIR)/debian/scripts/" dh $@ --with python3
override_dh_auto_install:
set -e && for py3vers in $(shell py3versions -sv); do \
python$$py3vers setup.py install --install-layout=deb \
--root $(CURDIR)/debian/python3-pattern; \
done
find debian/python*-pattern/ -type f -name "LICENSE.txt" -exec rm -fv {} \;
find debian/python*-pattern/ -type f -name "LICENSE" -exec rm -fv {} \;
#override_dh_install: run-tests
override_dh_install:
dh_install
find "debian/python3-pattern/usr/share/doc/python3-pattern/test" -type f -name "*.py" | \
while read -r F; do \
echo "Fixing $$F"; \
sed -i.bak 's/import os, sys; sys.path.insert(.*)/import os, sys/g' "$$F"; \
done
find "debian/python3-pattern/usr/share/doc/python3-pattern/test" -type f -name "*.py.bak" -delete
override_dh_installexamples:
dh_installexamples
find "debian/python3-pattern/usr/share/doc/python3-pattern/examples" -type f -name "*.py" | \
while read -r F; do \
echo "Fixing $$F"; \
sed -i.bak 's/import os, sys; sys.path.insert(.*)/import os, sys/g' "$$F"; \
done
find "debian/python3-pattern/usr/share/doc/python3-pattern/examples" -type f -name "*.py.bak" -delete
override_dh_auto_clean:
rm -rfv pattern/web/feed/
rm -rfv pattern/web/json/
rm -rfv pattern/web/soup/
rm -rfv pattern/vector/svm/liblinear-*/
rm -fv pattern/vector/svm/liblinear*.py
rm -rfv pattern/vector/svm/libsvm-*/
rm -fv pattern/vector/svm/libsvm.py
find pattern/text/en/wordnet/dict/ ! -name 'index.32' -type f -exec rm -fv {} +
set -e && for py3vers in $(shell py3versions -sv); do \
python$$py3vers setup.py clean -a; \
done
find . -name "*.pyc" -delete
rm -rfv build Pattern.egg-info
dh_clean
override_dh_compress:
dh_compress \
--exclude=.py \
--exclude=.txt \
--exclude=.csv \
--exclude=.docx \
--exclude=.pdf \
--exclude=.db \
--exclude=.html \
--exclude=.js \
--exclude=.gif \
--exclude=.jpg \
--exclude=.png
run-python3-tests:
dh_testdir
# Start tests
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_metrics.py
# pattern.web tests require a working internet connection
#LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_web.py
# pattern.db tests require a valid username and password for MySQL
#LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_db.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_de.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_en.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_es.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_fr.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_it.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_nl.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_ru.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_text.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_search.py
# vector tests require libsvm for Python3
#LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_vector.py
LC_ALL=C.UTF-8 LANG=C.UTF-8 python3 test/test_graph.py
# Clean everything
find . -name "*.pyc" -delete
run-tests: run-python3-tests
get-orig-source: clean
dh_testdir
dh_testroot
# Create temporary directory (removing it if it previously existed)
rm -rf debian/tmp
mkdir -p debian/tmp
# Download software
wget \
--output-document="debian/tmp/pattern-2.6+git5b85d99.zip" \
https://codeload.github.com/clips/pattern/zip/5b85d998c30ddc6772b56310713530224466083a
cd debian/tmp && unzip pattern-*.zip && rm -fv pattern-*.zip
# Remove unwanted pre-compiled files
rm -rfv debian/tmp/pattern-*/pattern/vector/svm/liblinear-*/
rm -rfv debian/tmp/pattern-*/pattern/vector/svm/libsvm-*/
# Fix permissions
find debian/tmp/pattern-*/. -type f -name "*.txt" -exec chmod 0644 {} \;
find debian/tmp/pattern-*/. -type f -name "*.rst" -exec chmod 0644 {} \;
find debian/tmp/pattern-*/. -type f -name "PKG-INFO" -exec chmod 0644 {} \;
find debian/tmp/pattern-*/. -type f -name "*.py" -exec chmod 0644 {} \;
find debian/tmp/pattern-*/. -type f -name "*.pyc" -exec rm -fv {} \;
# Replace shCore.js with the original source
patch debian/tmp/pattern-*/docs/js/shCore.js < debian/patches/replace-shCore-source.patch
# Create tarball
cd debian/tmp && tar cvfJ python-pattern_2.6+git20180818.orig.tar.xz pattern-*/
mv debian/tmp/python-pattern_*.orig.tar.xz ..
rm -rf debian/tmp
.PHONY: run-python2-tests run-python3-tests run-tests get-orig-source
|