File: rules

package info (click to toggle)
distribute 0.6.24-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,052 kB
  • sloc: python: 10,224; ansic: 198; makefile: 133
file content (186 lines) | stat: -rwxr-xr-x 5,958 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
181
182
183
184
185
186
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

# setuptools doesn't handle translated messages
export LC_ALL=C

#PYVERS	:= 2.3 2.5 $(shell pyversions -vr debian/control)
XPYVERS	:= 2.6 2.7
PYVERS	:= 2.6 2.7
PYVERS3	:= 3.2
PYVER   := $(shell python -c 'import sys; print sys.version[:3]')
SETUPTOOLSVER=0.6c11
export XPYVERS

include /usr/share/python3/python.mk

pname = $(if $(findstring 3.,$(2)),$(subst python-,python3-,$(1)),$(1))

p_dist	= python-distribute
p_pkgr	= python-pkg-resources
p_setp	= python-setuptools
p_doc	= python-distribute-doc

d_dist	= debian/$(p_dist)
d_pkgr	= debian/$(p_pkgr)
d_setp	= debian/$(p_setp)
d_doc	= debian/$(p_doc)

build: build-stamp
build-arch: build-stamp
build-indep: build-stamp build-doc-stamp
build-stamp: $(PYVERS:%=build-python%) $(PYVERS3:%=build-python%) build-doc-stamp
	touch $@
build-doc-stamp:
	cd docs && sphinx-build -b html -d build/doctrees . build/html
	touch $@
build-python%:
	python$* setup.py build
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-python* build-doc-stamp build-stamp
	rm -rf build dist
	-find -name '*.py[co]' | xargs rm -f
	rm -rf docs/build
	dh_clean

install: build install-prereq $(PYVERS:%=install-python%) $(PYVERS3:%=install-python%)
	find debian -name 'setuptools_boot.py*' | xargs -r rm -f
	find debian -name '*.py[co]' | xargs -r rm -f
	pkgs=$$(dh_listpackages); cd debian && find $$pkgs -mindepth 1 -type d -empty -print -delete

	rm -f debian/python-*/usr/bin/easy_install-3*
	rm -f debian/python3-*/usr/bin/easy_install-2*
	mv debian/python3-setuptools/usr/bin/easy_install \
	  debian/python3-setuptools/usr/bin/easy_install3

	: # Replace all '#!' calls to python with $(PYTHON)
	: # and make them executable
	for i in \
	  `find debian/python-*/usr/lib debian/python-*/usr/bin -type f`; \
	do \
	  case "$$i" in *-[0-9].[0-9]) continue; esac; \
	  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-*/usr/lib debian/python3-*/usr/bin -type f`; \
	do \
	  case "$$i" in *-[0-9].[0-9]) continue; esac; \
	  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_clean -k

install-python%:
	dh_installdirs -A usr/bin /$(call py_libdir,$*)
	python$* setup.py install \
	  --root=$(CURDIR)/$(call pname,$(d_setp),$*) --install-layout=deb

	mv $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/pkg_resources.py \
	  $(call pname,$(d_pkgr),$*)/$(call py_libdir,$*)/

#	mv $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/distribute-*.egg-info \
#	  $(call pname,$(d_dist),$*)/$(call py_libdir,$*)/

	mv $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/setuptools-$(SETUPTOOLSVER).egg-info \
	  $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/setuptools.egg-info

	rm -f $(call pname,$(d_dist),$*)/$(call py_libdir,$*)/setuptools.pth
	echo setuptools-$(SETUPTOOLSVER).egg-info \
	  > $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/setuptools.pth

binary-arch:

binary-indep: build install
	dh_testdir
	dh_testroot
#	dh_installchangelogs -p$(p_dist) CHANGES.txt
#	dh_installchangelogs -N$(p_dist)
	dh_installchangelogs -p$(p_setp) CHANGES.txt
	dh_installchangelogs -N$(p_setp)
	dh_installdocs -N$(p_setp) -N$(p_pkgr)
	dh_installdocs -p$(p_pkgr) docs/pkg_resources.txt
	dh_installdocs -p$(p_setp) -Xpkg_resources docs/*.txt
	mkdir -p $(d_doc)/usr/share/doc/$(p_dist)
	cp -pr docs/build/html $(d_doc)/usr/share/doc/$(p_dist)/
	dh_link -p$(p_doc) \
	  /usr/share/doc/$(p_dist)/html /usr/share/doc/$(p_doc)/html \
	  /usr/share/doc/$(p_dist)/html /usr/share/doc/$(p_setp)/html \
	  /usr/share/javacript/jquery/jquery.js /usr/share/doc/$(p_dist)/html/_static/jquery.js
	dh_compress -i
	dh_fixperms -i

	for v in $(filter-out 3.%, $(PYVERS)); do \
	  sed -i "s/python2\../python$$v/g" $(d_setp)/usr/bin/easy_install-$$v; \
	done
#	for v in $(filter-out 2.%, $(PYVERS)); do \
#	  sed -i "s/python3\../python$$v/g" debian/$(call pname,$(p_setp),3.1)/usr/bin/easy_install-$$v; \
#	done

	dh_python2 -p$(p_pkgr) -p$(p_setp) #-p$(p_dist)
	cat $(d_setp).substvars
	( \
	  echo 'python:Versions=2.6, 2.7'; \
	  echo 'python:Provides=python2.6-setuptools, python2.7-setuptools'; \
	  echo 'python:Depends=python (>= 2.6), python (<< 2.8)'; \
	) > $(d_setp).substvars
	cp $(d_setp).substvars $(d_pkgr).substvars

	dh_python3 -p$(call pname,$(p_pkgr),3.2) -p$(call pname,$(p_setp),3.2) # -p$(call pname,$(p_dist),3.2)
	cat debian/$(call pname,$(p_setp),3.2).substvars
	cat debian/$(call pname,$(p_pkgr),3.2).substvars

##	cp $(d_setp).substvars $(d_dist).substvars

	( \
	  echo 'python3:Versions=3.2'; \
	  echo 'python3:Provides=python3.2-setuptools'; \
	  echo 'python3:Depends=python3 (>= 3.1.2-8~)'; \
	) > $(call pname,$(d_setp),3.2).substvars
	cp $(call pname,$(d_setp),3.2).substvars $(call pname,$(d_pkgr),3.2).substvars

	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

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