~ubuntu-branches/ubuntu/trusty/python-networkx/trusty

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
#!/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 python2,python3

override_dh_auto_clean:
	dh_auto_clean

	# Add here commands to clean up after the build process.
	rm -fr build
	# 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 {} ';'

	# This directory is generated during the build
	rm -rf networkx.egg-info

override_dh_auto_build:
	dh_auto_build

	# build doc, run in a separate shell, so we can export MPLCONFIGDIR
#	(export MPLCONFIGDIR=. ; make -C doc dist PYTHONPATH=../$(LIB2))

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	# running tests
	set -e ; \
	for py in $(PYTHON2) ; do\
		PYTHONPATH=$(LIB2) $$py setup_egg.py nosetests; \
	done

	# running tests Python 3
	set -e ; \
	# running tests Python 3
	for py in $(PYTHON3) ; do\
		PYTHONPATH=$(LIB3) $$py setup_egg.py nosetests || true; \
	done
endif

override_dh_install:
	# Install w/o compiling *.pyc files
	# Install egg-info directories (--single-... option)
	python setup_egg.py install --no-compile --root=$(CURDIR)/debian/python-networkx \
		--single-version-externally-managed --install-layout=deb
	python3 setup_egg.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

	# 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

	# Do some cleanup: delete unneeded files:
	rm $(DEBIANDOC_DIR)/INSTALL.txt $(DEBIANDOC_DIR)/LICENSE.txt

	# Rename the README file.
	mv $(DEBIANDOC_DIR)/README.txt $(DEBIANDOC_DIR)/README

	dh_install

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/source/reference/news.rst