| 1 |
#!/usr/bin/make -f |
#!/usr/bin/make -f |
| 2 |
|
|
| 3 |
DEB_PYTHON_SYSTEM := pysupport |
include /usr/share/quilt/quilt.make |
| 4 |
DEB_PYTHON_MODULE_PACKAGE = python-django |
|
| 5 |
DEB_DH_COMPRESS_ARGS = -X.js |
PREFIX = debian/python-django |
| 6 |
|
DJANGO_DIR = $(PREFIX)/usr/lib/`pyversions -d`/site-packages/django |
| 7 |
include /usr/share/cdbs/1/rules/buildcore.mk |
|
| 8 |
include /usr/share/cdbs/1/rules/debhelper.mk |
%: |
| 9 |
include /usr/share/cdbs/1/class/python-distutils.mk |
dh $@ |
| 10 |
include /usr/share/cdbs/1/rules/simple-patchsys.mk |
|
| 11 |
|
build: $(QUILT_STAMPFN) |
| 12 |
binary-post-install/python-django:: |
dh $@ |
| 13 |
# Use default python shebang |
|
| 14 |
perl -pi -e 's|^#!/usr/bin/env python.*$$|#!/usr/bin/python|' debian/python-django/usr/share/python-support/python-django/django/conf/project_template/manage.py |
clean: unpatch |
| 15 |
# Ensure executability of some scripts that are copied to projects |
rm -rf docs.debian |
| 16 |
# (or used within projects) |
dh $@ |
| 17 |
chmod 755 debian/python-django/usr/share/python-support/python-django/django/conf/project_template/manage.py |
|
| 18 |
chmod 755 debian/python-django/usr/share/python-support/python-django/django/bin/[^_]*.py |
override_dh_auto_build: |
| 19 |
chmod 755 debian/python-django/usr/share/python-support/python-django/django/bin/profiling/[^_]*.py |
dh_auto_build |
| 20 |
# Create convenience symlink |
|
| 21 |
mkdir -p debian/python-django/usr/lib/python-django |
# Build the HTML documentation. |
| 22 |
dh_link usr/share/python-support/python-django/django/bin usr/lib/python-django/bin |
# We programmatically replace most instances of django-admin.py with |
| 23 |
|
# django-admin and remove the source files from the target _build. |
| 24 |
|
cp -r docs docs.debian |
| 25 |
|
find docs.debian -type f -print0 | xargs -0r perl -pi -e 's|(?<!/)(django-admin)\.py|$$1|' |
| 26 |
|
make -C docs.debian html |
| 27 |
|
rm -rf docs.debian/_build/html/_sources/ |
| 28 |
|
|
| 29 |
|
override_dh_install: |
| 30 |
|
dh_install |
| 31 |
|
|
| 32 |
|
# Use default shebang |
| 33 |
|
perl -pi -e 's|^#!/usr/bin/env python.*|#!/usr/bin/python|' $(DJANGO_DIR)/conf/project_template/manage.py |
| 34 |
|
chmod +x $(DJANGO_DIR)/conf/project_template/manage.py |
| 35 |
|
|
| 36 |
|
# Move scripts to /usr/lib/python-django |
| 37 |
|
mkdir -p $(PREFIX)/usr/lib/python-django |
| 38 |
|
mv $(DJANGO_DIR)/bin $(PREFIX)/usr/lib/python-django |
| 39 |
|
|
| 40 |
|
# Fix permissions |
| 41 |
|
chmod 644 $(PREFIX)/etc/bash_completion.d/django_bash_completion |
| 42 |
|
find $(PREFIX)/usr/lib/python-django/bin/ -name '*.py' -not -name '__init__.py' -print0 | xargs -0r chmod 755 |
| 43 |
|
|
| 44 |
# Rename django-admin.py to django-admin |
# Rename django-admin.py to django-admin |
| 45 |
mv debian/python-django/usr/bin/django-admin.py debian/python-django/usr/bin/django-admin |
mv $(PREFIX)/usr/bin/django-admin.py $(PREFIX)/usr/bin/django-admin |
| 46 |
|
|
| 47 |
build/python-django-doc:: |
override_dh_installdocs: |
| 48 |
# Build HTML documentation. |
dh_installdocs |
| 49 |
cd docs && make html |
# Remove embedded copy of libjs-jquery |
| 50 |
cd docs && make latex |
cd debian/python-django-doc/usr/share/doc/python-django-doc/html/_static \ |
| 51 |
cd docs/_build/latex && make all-pdf |
&& rm jquery.js \ |
|
# Something in that code forces pdf output so we have to |
|
|
# get our postscript from pdf: |
|
|
cd docs/_build/latex && pdf2ps django.pdf |
|
|
|
|
|
clean:: |
|
|
rm -rf docs/_build/* |
|
|
|
|
|
|
|
|
binary-post-install/python-django-doc:: |
|
|
# Remove convenience copy of libjs-jquery and replace with symlink. |
|
|
cd debian/python-django-doc/usr/share/doc/python-django-doc/html/_static\ |
|
|
&& rm -f jquery.js\ |
|
| 52 |
&& ln -s ../../../../javascript/jquery/jquery.js . |
&& ln -s ../../../../javascript/jquery/jquery.js . |
| 53 |
|
|
| 54 |
|
override_dh_compress: |
| 55 |
|
dh_compress -X.js |