#!/usr/bin/make -f DEBIANDOC_DIR=$(CURDIR)/debian/python-networkx/usr/share/doc/python-networkx LIB2 := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_platlib") LIB3 := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_platlib)") PYTHON2 := $(shell pyversions -r) PYTHON3 := $(shell py3versions -r) %: dh $@ --with sphinxdoc,python2,python3 override_dh_auto_clean: dh_auto_clean # Add here commands to clean up after the build process. rm -fr build networkx/version.py test.* doc/source/templates/gallery.html fontList.cache # Remove built doc too $(MAKE) -C doc clean rm -rf doc/source/*.pdf doc/source/*.zip examples/*/*.png doc/fontList.cache # Make sure that there's no .pyc left find . -name '*.pyc' -exec rm {} ';' override_dh_auto_test: ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),) #set -e ; \ # running tests -for py in $(PYTHON2) ; do\ PYTHONPATH=$(LIB2) $$py setup.py nosetests -v ; \ done #set -e ; \ # running tests Python 3 -for py in $(PYTHON3) ; do\ PYTHONPATH=$(LIB3) $$py setup.py nosetests -v ; \ done endif override_dh_install: # Install w/o compiling *.pyc files # Install egg-info directories (--single-... option) python setup.py install --no-compile --root=$(CURDIR)/debian/python-networkx \ --single-version-externally-managed --install-layout=deb python3 setup.py install --no-compile --root=$(CURDIR)/debian/python3-networkx \ --single-version-externally-managed --install-layout=deb # Fix executable bits: chmod +x debian/python-networkx/usr/lib/`pyversions -d`/*-packages/networkx/tests/test.py chmod +x debian/python3-networkx/usr/lib/*/*-packages/networkx/tests/test.py find debian/python-networkx -name '*.bz2' -exec chmod a-x {} ';' # fix test shebang sed 's|/usr/bin/env python|/usr/bin/python3|' -i debian/python3-networkx/usr/lib/*/*-packages/networkx/tests/test.py sed 's|/usr/bin/env python|/usr/bin/python3|' -i debian/python3-networkx/usr/lib/*/*-packages/networkx/generators/tests/test_random_graphs.py # remove duplicate examples rm -rf debian/python3-networkx/usr/share/doc/python-networkx # don't ship python 2 code for _decorator because it can't be byte-compiled rm -f debian/python3-networkx/usr/lib/python3/dist-packages/networkx/external/decorator/_decorator.py dh_install override_dh_sphinxdoc: ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS))) (export MPLCONFIGDIR=. ; make -C doc dist PYTHONPATH=../$(LIB2)) # install doc from dir 'dist', but rename it to 'html', better name cp -auxf doc/build/dist debian/python-networkx-doc/usr/share/doc/python-networkx-doc/html # link the pdf files also at the top level dir dh_link -ppython-networkx-doc /usr/share/doc/python-networkx-doc/html/_downloads/networkx_reference.pdf /usr/share/doc/python-networkx-doc/networkx_reference.pdf dh_link -ppython-networkx-doc /usr/share/doc/python-networkx-doc/html/_downloads/networkx_tutorial.pdf /usr/share/doc/python-networkx-doc/networkx_tutorial.pdf rm -rf debian/python-networkx-doc/usr/share/doc/python-networkx-doc/html/_static/jquery.js dh_link -ppython-networkx-doc /usr/share/javascript/jquery/jquery.js /usr/share/doc/python-networkx-doc/html/_static/jquery.js dh_link -ppython-networkx-doc /usr/share/javascript/mathjax/MathJax.js /usr/share/doc/python-networkx-doc/html/_static/MathJax.js # remove full doc zip file rm -f debian/python-networkx-doc/usr/share/doc/python-networkx-doc/html/_downloads/networkx-documentation.zip dh_sphinxdoc endif DEBVERS ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') VERSION ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//') NODFSG_VERSION ?= $(shell echo '$(VERSION)' | sed -e 's/\+dfsg[[:digit:]]*//') DEBFLAVOR ?= $(shell dpkg-parsechangelog | grep -E ^Distribution: | cut -d" " -f2) DEBPKGNAME ?= $(shell dpkg-parsechangelog | grep -E ^Source: | cut -d" " -f2) UPSTREAM_GIT ?= git://github.com/networkx/networkx.git update_intersphinx_mapping: wget http://docs.python.org/dev/objects.inv -O debian/python.org_objects.inv wget http://docs.scipy.org/doc/numpy/objects.inv -O debian/scipy.org_numpy_objects.inv override_dh_compress: dh_compress -Xexamples/ -X.js -X.pdf -Xobjects.inv override_dh_installchangelogs: dh_installchangelogs doc/news.rst