File: rules

package info (click to toggle)
python-django 1.2.3-3%2Bsqueeze15
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 29,720 kB
  • ctags: 21,538
  • sloc: python: 101,631; xml: 574; makefile: 149; sh: 121; sql: 7
file content (74 lines) | stat: -rwxr-xr-x 2,322 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
#!/usr/bin/make -f

-include /usr/share/python/python.mk
ifeq (,$(py_sitename))
  py_sitename = site-packages
  py_libdir = /usr/lib/python$(subst python,,$(1))/site-packages
  py_sitename_sh = $(py_sitename)
  py_libdir_sh = $(py_libdir)
endif


PREFIX = debian/python-django
DJANGO_DIR = $(PREFIX)/$(call py_libdir_sh,`pyversions -d`)/django

# FIXME: if the build is run while non-default python version are
# available, the build process will install files in
# /usr/lib/pyshared/pythonX.Y while we don't need them

%:
	dh $@

override_dh_auto_clean:
	rm -rf docs.debian tests/__init__.py
	find -name "*.DS_Store" -delete
	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
	rm -rf docs.debian/_build/html/_sources/

override_dh_auto_test:
	touch tests/__init__.py
	LC_ALL=en_US.utf8 PYTHONPATH=. tests/runtests.py --settings=tests.test_sqlite --verbosity=2

override_dh_install:
	dh_install
	
	# Use default shebang
	perl -pi -e 's|^#!/usr/bin/env python.*|#!/usr/bin/python|' $(DJANGO_DIR)/conf/project_template/manage.py
	chmod +x $(DJANGO_DIR)/conf/project_template/manage.py
	
	# Move scripts to /usr/lib/python-django
	mkdir -p $(PREFIX)/usr/lib/python-django
	mv $(DJANGO_DIR)/bin $(PREFIX)/usr/lib/python-django
	
	# Fix permissions
	chmod 644 $(PREFIX)/etc/bash_completion.d/django_bash_completion
	find $(PREFIX)/usr/lib/python-django/bin/ -name '*.py' -not -name '__init__.py' -print0 | xargs -0r chmod 755
	
	# Rename django-admin.py to django-admin
	mv $(PREFIX)/usr/bin/django-admin.py $(PREFIX)/usr/bin/django-admin
	
	# Remove embedded Javascript libraries
	for FILENAME in jquery.js jquery.min.js; do \
		find $(PREFIX) -name $$FILENAME -exec \
			ln -sf /usr/share/javascript/jquery/$$FILENAME {} \;; \
	done

override_dh_installdocs:
	dh_installdocs
	# Remove embedded copy of libjs-jquery
	cd debian/python-django-doc/usr/share/doc/python-django-doc/html/_static \
		&& rm jquery.js \
		&& ln -s ../../../../javascript/jquery/jquery.js .

override_dh_compress:
	dh_compress -X.js