File: rules

package info (click to toggle)
networkx 2.5%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,764 kB
  • sloc: python: 78,797; makefile: 141; javascript: 120
file content (82 lines) | stat: -rwxr-xr-x 2,986 bytes parent folder | download
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
#!/usr/bin/make -f

LIB3 := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_purelib)")
PYTHON3 := $(shell py3versions -r)

%:
	dh $@ --with sphinxdoc,python3 --buildsystem=pybuild

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 {} ';'

	rm -f doc/file.dot doc/fontlist-v330.json doc/path.png doc/path.to.file
	rm -f examples/advanced/edgelist.utf-8 examples/basic/grid.edgelist examples/pygraphviz/grid.dot examples/pygraphviz/k5.dot examples/pygraphviz/k5.ps examples/pygraphviz/k5_attributes.dot
	rm -rf .pytest_cache


override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	#set -e ; \
	# running tests Python 3
	-for py in $(PYTHON3) ; do\
		cd build ; \
		PYTHONPATH=../$(LIB3) $$py -m pytest --verbosity=2; \
		cd .. ; \
	done
endif

override_dh_install:
	# Install w/o compiling *.pyc files
	# Install egg-info directories (--single-... option)
	python3 setup.py install --no-compile --root=$(CURDIR)/debian/python3-networkx \
		--single-version-externally-managed --install-layout=deb

	# fix test shebang
	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=../$(LIB3))

	# 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

	cp -auxf doc/build/latex/networkx_reference.pdf debian/python-networkx-doc/usr/share/doc/python-networkx-doc/

	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

	dh_sphinxdoc
endif

override_dh_installexamples:
	dh_installexamples -ppython-networkx-doc examples/*

override_dh_compress:
	dh_compress -Xexamples/ -X.js -X.pdf -Xobjects.inv

override_dh_installchangelogs:
	dh_installchangelogs doc/news.rst

override_dh_missing:
	echo "I: Skipping dh_missing"