File: rules

package info (click to toggle)
pillow-sane 2.8.3-4
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 300 kB
  • sloc: ansic: 713; python: 356; makefile: 240; sh: 26
file content (123 lines) | stat: -rwxr-xr-x 3,154 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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PY3VERS	:= $(shell py3versions -vr)
PY3VER   := $(shell python3 -c 'import sys; print(sys.version[:3])')

include /usr/share/python3/python.mk

include /usr/share/dpkg/architecture.mk
ifneq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH))
  SET_CROSS_ENV = PYTHONPATH=/usr/lib/python$$pv/plat-$(DEB_HOST_MULTIARCH)

  # FIXME: is this sufficient?
  SET_CROSS_ENV += _PYTHON_HOST_PLATFORM=$(DEB_HOST_GNU_CPU)
endif

build-arch: build
build-indep: build
build: build-stamp
build-stamp: $(PY3VERS:%=build-stamp-python%) $(PY3VERS:%=check-stamp-python%)
	touch $@
build-stamp-python%:
	$(SET_CROSS_ENV) python$* setup.py build

	$(SET_CROSS_ENV) python$*-dbg setup.py build
	touch $@

pillow_tests = $(wildcard Tests/test*.py)

check-stamp-python%:
ifeq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH))
	: # pillow Sane doesn't have any tests
endif
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f *-stamp*
	rm -rf compile build
	rm -rf debian/PILcompat/build
	rm -rf Pillow*.egg-info
	find -name '*.py[co]' -exec rm -f {} \;
	find -type d -name __pycache__ | xargs -r rm -rf
	rm -rf tmp
	dh_clean

install: build install-prereq $(PY3VERS:%=install3-python%)
	dh_installdocs -ppython3-sane sanedoc.txt
#	dh_installexamples -ppython-sane demo*.py

	: # Replace all '#!' calls to python with /usr/bin/python
	: # and make them executable
	for i in `find debian/python-pil* -mindepth 3 -type f`; do \
	  sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\1,' \
		$$i > $$i.temp; \
	  if cmp --quiet $$i $$i.temp; then \
	    rm -f $$i.temp; \
	  else \
	    mv -f $$i.temp $$i; \
	    chmod 755 $$i; \
	    echo "fixed interpreter: $$i"; \
	  fi; \
	done
	for i in `find debian/python3-pil* -mindepth 3 -type f`; do \
	  sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \
		$$i > $$i.temp; \
	  if cmp --quiet $$i $$i.temp; then \
	    rm -f $$i.temp; \
	  else \
	    mv -f $$i.temp $$i; \
	    chmod 755 $$i; \
	    echo "fixed interpreter: $$i"; \
	  fi; \
	done

install-prereq:
	dh_testdir
	dh_testroot
	dh_prep

install3-python%:
	$(SET_CROSS_ENV) python$* setup.py install \
		--root $(CURDIR)/debian/python3-sane $(py_setup_install_args)

	$(SET_CROSS_ENV) python$*-dbg setup.py install \
		--root $(CURDIR)/debian/python3-sane-dbg $(py_setup_install_args)

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installexamples -a
	dh_installchangelogs -a #CHANGES
	for p in \
	  python3-sane; \
	do \
	  rm -rf debian/$$p-dbg/usr/share/doc/$$p-dbg; \
	  ln -s $$p debian/$$p-dbg/usr/share/doc/$$p-dbg; \
	done
	dh_python3 -a
	dh_numpy3 -a
	dh_strip -ppython3-sane --dbg-package=python3-sane-dbg
	dh_link -a
	dh_compress -a -X.py
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install