File: rules

package info (click to toggle)
python-scientific 2.8-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 6,456 kB
  • sloc: python: 16,436; ansic: 4,379; makefile: 141; sh: 18; csh: 1
file content (180 lines) | stat: -rwxr-xr-x 4,863 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

# OpenMPI is only supported on a subset of architectures at this time.
# This list should remain synced with the Build-Depends and the Architecture
# line of openmpipython in debian/control.

OPENMPI_ARCH    = alpha amd64 i386 ia64 powerpc sparc kfreebsd-i386 kfreebsd-amd64 hurd-i386
DEB_HOST_ARCH  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

export SHELL=bash

pv	= $(shell pyversions -vd)
PYVERS	= $(shell pyversions -vs)
PYTHON	= /usr/bin/python #$(pv)
PLATFORM = $(shell $(PYTHON) -c 'import sys; print sys.platform')

p_sci	= python-scientific
p_cdf	= python-netcdf
p_doc	= $(p_sci)-doc
p_mpi	= python-mpi
p_pympi	= mpich2python
p_pyopenmpi	= openmpipython

d_sci	= debian/$(p_sci)
d_cdf	= debian/$(p_cdf)
d_doc	= debian/$(p_doc)
d_mpi	= debian/$(p_mpi)
d_pympi	= debian/$(p_pympi)
d_pyopenmpi	= debian/$(p_pyopenmpi)

include /usr/share/python/python.mk

xx:
	@echo $(pv)
	@echo '$(CURDIR)/build/lib.*-$(pv)'
	@echo $(CURDIR)/build/lib.*-$(pv)
	@echo $(wildcard $(CURDIR)/build/lib.*-$(pv))
	@cd Src/MPI && echo XX $(wildcard $(CURDIR)/build/lib.*-$(pv))

build: stamp-build
stamp-build:
	dh_testdir
	set -e; \
	for v in $(PYVERS); do \
	  python$$v setup.py build; \
	done
	rm -f Src/MPI/*.o
	cd Src/MPI && PYTHONPATH=$$(echo $(CURDIR)/build/lib.*-$(pv)) USE_OPENMPI=yes $(PYTHON) compile.py
	rm -f Src/MPI/*.o
	cd Src/MPI && PYTHONPATH=$$(echo $(CURDIR)/build/lib.*-$(pv)) USE_MPICH=yes   $(PYTHON) compile.py
	touch stamp-build

cdf_dirs = \
	usr/lib/python$(pv)/$(call py_sitename, $(pv)) \
	usr/include/python$(pv) \
	usr/share/doc/$(p_cdf)/examples

sci_dirs = \
	usr/lib/python$(pv)/$(call py_sitename, $(pv)) \
	usr/share/doc/$(p_sci)

doc_dirs = \
	usr/share/doc/$(p_sci) \
	usr/share/doc/$(p_doc)

mpi_dirs = \
	usr/lib/python$(pv)/$(call py_sitename, $(pv)) \
	usr/share/doc/$(p_mpi)/examples \
	usr/bin

pympi_dirs = \
	usr/share/doc/ \
	usr/bin \
	usr/share/man/man1

pyopenmpi_dirs = \
	usr/share/doc/ \
	usr/bin \
	usr/share/man/man1

install: build
	dh_testdir
	dh_testroot
	dh_clean -k

	dh_installdirs -p$(p_sci) $(sci_dirs)
	dh_installdirs -p$(p_doc) $(doc_dirs)
	dh_installdirs -p$(p_cdf) $(cdf_dirs)
	dh_installdirs -p$(p_mpi) $(mpi_dirs)
	dh_installdirs -p$(p_pympi) $(pympi_dirs)
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH)))
	dh_installdirs -p$(p_pyopenmpi) $(pyopenmpi_dirs)
endif

	set -e; \
	for v in $(PYVERS); do \
	  mkdir -p $(d_sci)/usr/lib/python$(v)/$(call py_sitename, $(v)); \
	  mkdir -p $(d_cdf)/usr/lib/python$(v)/$(call py_sitename, $(v)); \
	  python$$v setup.py install --root=`pwd`/$(d_sci) $(py_setup_install_args); \
	done
	-find debian -name '*.py[co]' | xargs rm -f

	DH_COMPAT=2 dh_movefiles -v -p$(p_mpi) --sourcedir=$(d_sci) \
		usr/lib/python*/*-packages/Scientific/MPI \
		usr/include/python*/Scientific/{PyMPI_API.h,mpimodule.h}

	install -m775 Src/MPI/mpipython.mpich2 $(d_pympi)/usr/bin/
	cp -p debian/mpipython.1 $(d_pympi)/usr/share/man/man1/mpipython.mpich2.1
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH)))
	install -m775 Src/MPI/mpipython.openmpi $(d_pyopenmpi)/usr/bin/
	cp -p debian/mpipython.1 $(d_pyopenmpi)/usr/share/man/man1/mpipython.openmpi.1
endif

	-find $(d_sci) $(d_sci2) -name '*.py[co]' | xargs rm -f

	DH_COMPAT=2 dh_movefiles -v -p$(p_cdf) --sourcedir=$(d_sci) \
		usr/lib/python*/*-packages/Scientific/$(PLATFORM) \
		usr/include/python*/Scientific/netcdfmodule.h

	rm -rf $(d_sci)/usr/include

	mv $(d_sci)/usr/bin/task_manager \
	   $(d_sci)/usr/bin/task_manager_pyscientific

clean:
	dh_testdir
	rm -f stamp-build
	rm -rf `find -name build -type d`
	rm -f `find . -name '*.py[co]'`
	rm -f Src/MPI/mpipython{,.openmpi,.mpich2} Src/MPI/*.o
	dh_clean

binary-indep: install
	dh_testdir
	dh_testroot

	cp -a Doc/* \
		$(d_doc)/usr/share/doc/$(p_sci)/.

	dh_installdocs -p$(p_sci) -p$(p_doc) README
	dh_installdocs -p$(p_mpi) README.MPI debian/README
	dh_installchangelogs -i
	cp -p Examples/mpi.py $(d_mpi)/usr/share/doc/$(p_mpi)/examples/.
	dh_compress -i -X.py -X.c -X.pdf
	dh_fixperms -i
	dh_python2 -i
	dh_python -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: install
	dh_testdir
	dh_testroot

	dh_installdocs -p$(p_cdf) README
	ln -sf $(p_mpi) $(d_pympi)/usr/share/doc/$(p_pympi)
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH)))
	ln -sf $(p_mpi) $(d_pyopenmpi)/usr/share/doc/$(p_pyopenmpi)
endif

	dh_installchangelogs -a
	dh_installexamples -p$(p_cdf)  Examples/*
	rm -f $(d_cdf)/usr/share/doc/$(p_cdf)/examples/mpi.py
	dh_strip -a
	dh_compress -a -X.py -X.c
	dh_fixperms -a
	dh_python2 -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean checkroot