File: README

package info (click to toggle)
python-support 0.5.6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 172 kB
  • ctags: 84
  • sloc: python: 434; perl: 212; sh: 20; makefile: 11
file content (135 lines) | stat: -rw-r--r-- 4,510 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
Python-support is a tool to handle byte-compilation of python modules 
when there are several python versions installed on the system.


How does it work?
=================
Python-support looks for modules in /usr/share/python-support.
 * Private modules (.py files that shouldn't be installed in the default 
   sys.path) are handled through a foo.dirs file, which contains a list 
   of directories in which to find modules. If the directory contains a 
   .pyversion file, they will be bytecompiled with the python version 
   described inside, otherwise the current python version will be used.
 * Public modules (.py files that should be installed in the default 
   sys.path) are handled through a foo/ subdirectory, containing a 
   hierarchy as normally found in /usr/lib/pythonX.Y/site-packages/. 
   They will be installed and bytecompiled in each python specific 
   directory: /var/lib/python-support/pythonX.Y/. If a .version file is
   found in /usr/share/python-support/foo/, it will be parsed for the 
   list of python versions the module supports. It should look like 
   e.g.:
	2.2,2.4-
   for a package supporting python2.2, and all versions starting from 
   python2.4.
 * Public extensions (.so files) are handled just like public modules, 
   but extensions for each pythonX.Y version will be searched in
   /usr/lib/python-support/foo/pythonX.Y/ and installed in 
   /var/lib/python-support/pythonX.Y/ together with the corresponding 
   modules. No .version file is needed in this case, and the modules 
   will be installed only for the python versions supported by the 
   extensions.

How to make a package using it?
===============================
All the work is done using dh_pysupport. Most packages built for the 
"old" policy can just be changed to use dh_pysupport instead of 
dh_python, and this should work. Packages building binary extensions 
should also be changed to build the extensions for all python versions 
in a single package.

*** You don't need X[BS]-Python-Version fields. You don't need ***
*** debian/pycompat. Just remove all of these.                 ***

(You can also use dh_python to generate the dependencies instead, but 
this is not recommended as it is less clever in their generation. In 
this case, you'll need the debian/pycompat file.)

Of course, don't forget the dependency fields:
	Build-Depends: python-support (>= 0.4), debhelper(>= 5)
	Depends: ${python:Depends}

If you're including public modules or extensions, you can also add the 
optional field:
	Provides: ${python:Provides}

 For a package with only private modules
 ---------------------------------------

In this case, the rules file will probably look like this:

build:
	make ...

install:
	make install DESTDIR=debian/foo/

binary-indep:
	...
	dh_pysupport
	dh_installdeb
	...

If the private modules are not in a default directory (like 
/usr/share/$package or /usr/lib/$package) you should pass the directory 
to dh_pysupport and dh_python:
	dh_pysupport /usr/share/someframework/foo

If the modules need a specific python version, you can pass the -V 
argument to dh_pysupport; it works exactly like for the old dh_python.
	dh_pysupport -V2.4

 For a package with public modules
 ---------------------------------
If the module doesn't work with all python versions, you should setup a
debian/pyversions file. If the package needs python >= 2.3, it will look
like :
	2.3-
This file will be installed in /usr/share/python-support/foo/.version.

The rules file will look like this:

build:
	...
	python setup.py build

install:
	...
	python setup.py install --root=$(CURDIR)/debian/python-foo

binary-indep:
	...
	dh_pysupport
	dh_installdeb
	...

 For a package with public C extensions:
 ---------------------------------------
First of all, you should build-depend on python-all-dev.

If you want to build the extension only for some python versions, you 
should create a debian/pyversions file as described earlier, and set in 
the rules file:
PYVERS=$(shell pyversions -vr)
You need to build-depend on python (>= 2.3.5-11) for this to work.

Otherwise, you can just build the extensions for all supported python 
versions:
PYVERS=$(shell pyversions -vs)

The rest of the rules file will look like:

build: $(PYVERS:%=build-python%)
	touch $@
build-python%:
	python$* setup.py build
	touch $@

install: build $(PYVERS:%=install-python%)
install-python%:
	python$* setup.py install --root $(CURDIR)/debian/python-foo

binary-arch:
	...
	dh_pysupport
	dh_installdeb
	...