#!/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