3
3
DEBIANDOC_DIR=$(CURDIR)/debian/python-networkx/usr/share/doc/python-networkx
4
PYLIBPATH := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_platlib")
4
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")
5
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)")
6
PYTHON2 := $(shell pyversions -r)
7
PYTHON3 := $(shell py3versions -r)
10
dh $@ --with sphinxdoc,python3
9
12
override_dh_auto_clean:
21
24
# This directory is generated during the build
22
25
rm -rf networkx.egg-info
24
build: build-arch build-indep ;
27
override_dh_auto_build:
30
# build doc, run in a separate shell, so we can export MPLCONFIGDIR
31
(export MPLCONFIGDIR=. ; make -C doc dist PYTHONPATH=../$(LIB2))
33
override_dh_auto_test:
34
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
30
for py in $(shell pyversions -r) ; do\
31
PYTHONPATH=$(PYLIBPATH) $$py setup_egg.py nosetests ; \
35
# build doc, run in a separate shell, so we can export MPLCONFIGDIR
36
(export MPLCONFIGDIR=. ; make -C doc dist PYTHONPATH=../$(PYLIBPATH))
37
for py in $(PYTHON2) ; do\
38
PYTHONPATH=$(LIB2) $$py setup_egg.py nosetests ; \
41
# running tests Python 3
42
for py in $(PYTHON3) ; do\
43
PYTHONPATH=$(LIB3) $$py setup_egg.py nosetests ; \
38
47
override_dh_install:
39
48
# Install w/o compiling *.pyc files
40
49
# Install egg-info directories (--single-... option)
41
50
python setup_egg.py install --no-compile --root=$(CURDIR)/debian/python-networkx \
42
51
--single-version-externally-managed --install-layout=deb
52
python3 setup_egg.py install --no-compile --root=$(CURDIR)/debian/python3-networkx \
53
--single-version-externally-managed --install-layout=deb
44
55
# Fix executable bits:
45
56
chmod +x debian/python-networkx/usr/lib/`pyversions -d`/*-packages/networkx/tests/test.py
57
chmod +x debian/python3-networkx/usr/lib/*/*-packages/networkx/tests/test.py
46
58
find debian/python-networkx -name '*.bz2' -exec chmod a-x {} ';'
61
sed 's|/usr/bin/env python|/usr/bin/python3|' -i debian/python3-networkx/usr/lib/*/*-packages/networkx/tests/test.py
63
# remove duplicate examples
64
rm -rf debian/python3-networkx/usr/share/doc/python-networkx
66
# don't ship python 2 code for _decorator because it can't be byte-compiled
67
rm -f debian/python3-networkx/usr/lib/python3/dist-packages/networkx/external/decorator/_decorator.py
48
69
# Do some cleanup: delete unneeded files:
49
70
rm $(DEBIANDOC_DIR)/INSTALL.txt $(DEBIANDOC_DIR)/LICENSE.txt