rules 2.97 KB
Newer Older
1 2
#!/usr/bin/make -f

3 4
PY2VERS := $(shell pyversions -s)
PY3VERS := $(shell py3versions -s)
Sandro Tosi's avatar
Sandro Tosi committed
5
LIB := $$(python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_platlib")
6

7
%:
8
	dh $@ --with sphinxdoc,python2,python3
9 10 11

override_dh_auto_install:
	set -e ; \
12
	cython3 -2 src/*pyx; \
13
	for python in $(PY2VERS); do \
Sandro Tosi's avatar
Sandro Tosi committed
14 15 16 17
		mkdir -p $(CURDIR)/debian/python-mpltoolkits.basemap/usr/lib/python2.7/dist-packages ; \
		PYTHONPATH=$(CURDIR)/debian/python-mpltoolkits.basemap/usr/lib/python2.7/dist-packages $$python setup.py install --prefix $(CURDIR)/debian/python-mpltoolkits.basemap/usr --install-layout=deb; \
		mkdir -p $(CURDIR)/debian/python-mpltoolkits.basemap-dbg/usr/lib/python2.7/dist-packages ; \
		PYTHONPATH=$(CURDIR)/debian/python-mpltoolkits.basemap-dbg/usr/lib/python2.7/dist-packages $$python-dbg setup.py install --prefix $(CURDIR)/debian/python-mpltoolkits.basemap-dbg/usr --install-layout=deb; \
18
	done
19
	set -e ; \
20
	cython3 -3 src/*pyx; \
21
	for python in $(PY3VERS); do \
Sandro Tosi's avatar
Sandro Tosi committed
22 23 24 25
		mkdir -p $(CURDIR)/debian/python3-mpltoolkits.basemap/usr/lib/python3/dist-packages ; \
		PYTHONPATH=$(CURDIR)/debian/python3-mpltoolkits.basemap/usr/lib/python3/dist-packages $$python setup.py install --prefix $(CURDIR)/debian/python3-mpltoolkits.basemap/usr --install-layout=deb; \
		mkdir -p $(CURDIR)/debian/python3-mpltoolkits.basemap-dbg/usr/lib/python3/dist-packages ; \
		PYTHONPATH=$(CURDIR)/debian/python3-mpltoolkits.basemap-dbg/usr/lib/python3/dist-packages $$python-dbg setup.py install --prefix $(CURDIR)/debian/python3-mpltoolkits.basemap-dbg/usr --install-layout=deb; \
26
	done
Sandro Tosi's avatar
Sandro Tosi committed
27
	dh_numpy
28

Sandro Tosi's avatar
Sandro Tosi committed
29 30
override_dh_python2:
	dh_python2
31
	# remove namespace file, already shipped with python-matplotlib
32 33 34 35 36 37 38
	rm $(CURDIR)/debian/python-mpltoolkits.basemap/usr/lib/python2*/dist-packages/mpl_toolkits/__init__.py


override_dh_python3:
	dh_python3
	# remove namespace file, already shipped with python3-matplotlib
	rm $(CURDIR)/debian/python3-mpltoolkits.basemap/usr/lib/python3*/dist-packages/mpl_toolkits/__init__.py
Sandro Tosi's avatar
Sandro Tosi committed
39 40 41 42 43 44

build: build-arch build-indep ;

build-arch:
	dh build

45
build-indep: build-arch
Sandro Tosi's avatar
Sandro Tosi committed
46 47 48
	# HACK: we need to import axes_grid1 but we need to import it from the "local"
	# mpl_toolkits namespace
	ln -s $$(dirname $$(python -c "import mpl_toolkits.axes_grid1 as p; print p.__file__")) $(CURDIR)/$(LIB)/mpl_toolkits/
Sandro Tosi's avatar
Sandro Tosi committed
49
	# build doc only for default python version
Sandro Tosi's avatar
Sandro Tosi committed
50 51 52
	(export MPLCONFIGDIR=. ; cd doc ; PYTHONPATH=$(CURDIR)/$(LIB) BASEMAPDATA=$(CURDIR)/lib/mpl_toolkits/basemap/data/ python make.py html)
	# remove hack
	rm $(CURDIR)/$(LIB)/mpl_toolkits/axes_grid1
Sandro Tosi's avatar
Sandro Tosi committed
53 54 55

override_dh_sphinxdoc:
	dh_sphinxdoc -i
Sandro Tosi's avatar
Sandro Tosi committed
56 57 58 59 60

override_dh_clean:
	dh_clean
	rm -rf doc/build
	rm -f nad2bin.o nad2bin
61 62 63

override_dh_builddeb:
	dh_builddeb -- -Zxz
64 65 66 67

override_dh_strip:
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip -ppython-mpltoolkits.basemap --dbg-package=python-mpltoolkits.basemap-dbg
68
	dh_strip -ppython3-mpltoolkits.basemap --dbg-package=python3-mpltoolkits.basemap-dbg
69
endif