File: rules

package info (click to toggle)
python-pattern 2.6%2Bgit20150109-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,672 kB
  • sloc: python: 53,865; xml: 11,965; ansic: 2,318; makefile: 94
file content (132 lines) | stat: -rwxr-xr-x 4,313 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

export DH_VERBOSE=1

%:
	#dh $@ --with python2,python3
	dh $@ --with python2

override_dh_auto_install: 
	set -e && for pyvers in $(shell pyversions -vr); do \
		python$$pyvers setup.py install --install-layout=deb \
			--root $(CURDIR)/debian/python-pattern; \
	done

	#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:
	dh_install

	find "debian/python-pattern/usr/share/doc/python-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/python-pattern/usr/share/doc/python-pattern/test" -type f -name "*.py.bak" -delete


override_dh_installexamples:
	dh_installexamples

	find "debian/python-pattern/usr/share/doc/python-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/python-pattern/usr/share/doc/python-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 pyvers in $(shell pyversions -vr); do \
		python$$pyvers setup.py clean -a; \
	done

	#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-tests:
	dh_testdir
	# Start tests
	LC_ALL=C LANG=C python test/test_metrics.py
	# pattern.web tests require a working internet connection
	#LC_ALL=C LANG=C python test/test_web.py
	# pattern.db tests require a valid username and password for MySQL
	#LC_ALL=C LANG=C python test/test_db.py
	LC_ALL=C LANG=C python test/test_de.py
	LC_ALL=C LANG=C python test/test_en.py
	LC_ALL=C LANG=C python test/test_es.py
	LC_ALL=C LANG=C python test/test_fr.py
	LC_ALL=C LANG=C python test/test_it.py 
	LC_ALL=C LANG=C python test/test_nl.py
	LC_ALL=C LANG=C python test/test_text.py
	LC_ALL=C LANG=C python test/test_search.py
	LC_ALL=C LANG=C python test/test_vector.py
	LC_ALL=C LANG=C python test/test_graph.py
	# Clean everything
	find . -name "*.pyc" -delete


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+git820cccf.zip" \
		https://codeload.github.com/clips/pattern/zip/820cccf33c6ac4a4f1564a273137171cfa6ab7cb
	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 {} \;
	chmod +x debian/tmp/pattern-*/pattern/server/cherrypy/cherrypy/cherryd
	# 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+git20150109.orig.tar.xz pattern-*/
	mv debian/tmp/python-pattern_*.orig.tar.xz ..
	rm -rf debian/tmp