File: rules

package info (click to toggle)
python-django 1.7.11-1%2Bdeb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 45,624 kB
  • sloc: python: 171,189; xml: 713; sh: 203; makefile: 199; sql: 11
file content (94 lines) | stat: -rwxr-xr-x 3,463 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/make -f

export PYBUILD_NAME=django

PREFIX = debian/python-django
PREFIX3 = debian/python3-django
PREFIXC = debian/python-django-common

%:
	dh $@ --with sphinxdoc,python2,python3 --buildsystem=pybuild

override_dh_auto_clean:
	rm -rf docs.debian
	find -name "*.DS_Store" -delete
	chmod a-x django/contrib/gis/tests/data/texas.dbf
	dh_auto_clean

override_dh_auto_build:
	dh_auto_build
	
	# Build the HTML documentation.
	# We programmatically replace most instances of django-admin.py with
	# django-admin and remove the source files from the target _build.
	cp -r docs docs.debian
	find docs.debian -type f -print0 | xargs -0r perl -pi -e 's|(?<!/)(django-admin)\.py|$$1|'
	make -C docs.debian html

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	mkdir -p tmp-locales
	localedef -i /usr/share/i18n/locales/en_US -c -f UTF-8 -A /usr/share/locale/locale.alias tmp-locales/en_US.UTF-8
	cd tests && LOCPATH=$(CURDIR)/tmp-locales LC_ALL=en_US.UTF-8 PYTHONPATH=.. python ./runtests.py --verbosity=2
	cd tests && LOCPATH=$(CURDIR)/tmp-locales LC_ALL=en_US.UTF-8 PYTHONPATH=.. python3 ./runtests.py --verbosity=2
	rm -rf tmp-locales
endif

override_dh_clean:
	# backup~ is used in tests
	dh_clean -Xbackup~

override_dh_auto_install:
	dh_auto_install

	# Drop extra license files
	find $(PREFIX) -name LICENSE -o -name license.txt -o -name license.python.txt | \
	    xargs --no-run-if-empty rm
	find $(PREFIX3) -name LICENSE -o -name license.txt -o -name license.python.txt | \
	    xargs --no-run-if-empty rm

	# Drop django-admin{,.py} which is in python-django-common and
	# clean up empty parent directories
	rm $(PREFIX)/usr/bin/django-admin*
	rm $(PREFIX3)/usr/bin/django-admin*
	rmdir --ignore-fail-on-non-empty --parents $(PREFIX)/usr/bin $(PREFIX3)/usr/bin

	# Fix the shebang lines to use python3 in python3-django
	find $(PREFIX3) -name django-admin.py -or -name manage.py | \
	    xargs --no-run-if-empty sed -i -e '1s/python$$/python3/'

	# Remove embedded Javascript libraries
	set -e; for FILENAME in jquery.js jquery.min.js; do \
		find $(PREFIX) -name $$FILENAME -exec \
			ln -sf /usr/share/javascript/jquery/$$FILENAME {} \;; \
		find $(PREFIX3) -name $$FILENAME -exec \
			ln -sf /usr/share/javascript/jquery/$$FILENAME {} \;; \
	done

override_dh_install:
	dh_install
	
	# Fix permissions
	chmod 644 $(PREFIXC)/etc/bash_completion.d/django_bash_completion
	chmod 755 $(PREFIXC)/usr/bin/django-admin

override_dh_python3:
	dh_python3
	find debian/python3-django/usr/lib/python3/dist-packages/ -type f -not -name '*.py' | \
	(while read file; do \
		relname=$${file##debian/python3-django/usr/lib/python3/dist-packages/}; \
		reldirname=$$(dirname $$relname); \
		mkdir -p debian/python-django-common/usr/share/python-django-common/$$reldirname; \
		mv $$file debian/python-django-common/usr/share/python-django-common/$$reldirname/; \
		ln -sf /usr/share/python-django-common/$$relname $$file; \
		if test -e debian/python-django/usr/share/pyshared/$$relname; then \
		    rm debian/python-django/usr/share/pyshared/$$relname; \
		    ln -sf /usr/share/python-django-common/$$relname debian/python-django/usr/share/pyshared/$$relname; \
		else \
		    rm debian/python-django/usr/lib/python2.7/dist-packages/$$relname; \
		    ln -sf /usr/share/python-django-common/$$relname debian/python-django/usr/lib/python2.7/dist-packages/$$relname; \
		fi \
	done)

override_dh_compress:
	dh_compress -X.js -Xobjects.inv