File: rules

package info (click to toggle)
pillow 12.1.0-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 72,560 kB
  • sloc: python: 49,748; ansic: 38,748; makefile: 302; sh: 168; javascript: 85
file content (168 lines) | stat: -rwxr-xr-x 4,686 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

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

PY3VERS	:= $(shell py3versions -vr)
PY3VER	:= $(shell py3versions -vd)

include /usr/share/dpkg/buildflags.mk
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-indep:
build-arch: build
build-indep: build build-doc-stamp
build: build-stamp

build-doc-stamp: build
	: # FIXME: do not ignore warnings ...
#	-PYTHONPATH=$(CURDIR)/src:$(CURDIR)/$(lastword $(wildcard build/lib.*)) $(MAKE) -C docs html
	(cd src; tar cf - PIL) | (cd $(lastword $(wildcard build/lib.*)); tar xf -)
	-PYTHONPATH=$(CURDIR)/$(lastword $(wildcard build/lib.*)) $(MAKE) -C docs html
	touch $@

build-stamp: $(PY3VERS:%=build-stamp-python%) $(PY3VERS:%=check-stamp-python%)
	touch $@
build-stamp-python%:
#	tar xvf debian/lcms-images.tar.gz
	$(SET_CROSS_ENV) python$* setup.py build
	touch $@

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

check-stamp-python%:
ifeq (0,1)
ifeq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH))
	rm -rf tmp
	mkdir -p tmp
	ln -s ../Tests tmp/Tests
	ln -s ../build tmp/build
	@echo BEGIN python$* tests
	-cd tmp && python$* ../debian/test-built.py --processes=1 --process-timeout=90 $(pillow_tests)
endif
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 -f $$(tar tf debian/lcms-images.tar.gz)
	rm -rf tmp
	rm -rf docs/_build
	dh_clean

get-doc:
	wget -r --no-parent --no-host-directories --cut-dirs=2 \
		http://www.pythonware.com/library/pil/handbook/index.htm

install: build install-prereq $(PY3VERS:%=install3-python%)
	dh_installdocs -ppython-pil-doc #Docs/*
	dh_installexamples -ppython-pil-doc

	dh_installdocs -ppython3-pil README.md

	: # Replace all '#!' calls to python with /usr/bin/python
	: # and make them executable
	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-pil \
		$(py_setup_install_args)

	incdir=$$(python$* -c 'import sysconfig; print(sysconfig.get_path("include"))'); \
	mkdir -p debian/python3-pil/$$incdir; \
	install -o root -g root -m 644 \
		src/libImaging/Imaging.h \
		src/libImaging/ImagingUtils.h \
		src/libImaging/ImPlatform.h \
		src/libImaging/ImDib.h \
		debian/python3-pil/$$incdir

	: # FIXME: not installed anymore upstream?
	mkdir -p debian/python3-pil/usr/lib/python3/$(call py_sitename_sh, $*)/PIL
	(cd src; tar cf - PIL) \
	  | (cd debian/python3-pil/usr/lib/python3/$(call py_sitename_sh, $*); tar xf -)

	if `python$* -c "import sys; sys.exit(sys.version_info < (3,5))"`; \
	then \
		abitag=.$$(python$* -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))"); \
	else \
		abitag=.$$(python$* -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))")-$(DEB_HOST_MULTIARCH); \
	fi; \
	echo $$abitag; \
	dh_movefiles -ppython3-pil.imagetk \
	    --sourcedir=debian/python3-pil \
		usr/lib/python3/$(call py_sitename_sh, $*)/PIL/_imagingtk$$abitag.so \
		usr/lib/python3/$(call py_sitename_sh, $*)/PIL/ImageTk.py

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: build build-doc-stamp install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installdocs -ppython-pil-doc docs/_build/html
	dh_sphinxdoc -ppython-pil-doc
	dh_installexamples -i
	dh_installchangelogs -i CHANGES.rst
	dh_python3 -i
	dh_link -i
	dh_compress -i -X.py
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -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.rst
	dh_python3 -a
	dh_strip -a
	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