| 1 |
HOWTO convert package to python-central
|
| 2 |
=======================================
|
| 3 |
|
| 4 |
1) debian/control
|
| 5 |
|
| 6 |
* source package:
|
| 7 |
- add XS-Python-Version: header with list of python versions that package
|
| 8 |
supports. Examples: all / >=2.3 / 2.3, 2.4 / >=2.3, <<2.6 / current
|
| 9 |
- extend Build-Depends: header with:
|
| 10 |
debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6)
|
| 11 |
- for Egg support (optional) extend Build-Depends: header with:
|
| 12 |
python-setuptools (>= 0.6b3-1)
|
| 13 |
* binary package:
|
| 14 |
- add/extend headers:
|
| 15 |
Depends: ${python:Depends}
|
| 16 |
XB-Python-Version: ${python:Versions}
|
| 17 |
- change Architecture: to "all" ("any" if package contains arch dep files)
|
| 18 |
- if previous package version had python2.X-foo packages, add:
|
| 19 |
Conflicts: python2.X-foo (<< current_version)
|
| 20 |
Replaces: python2.X-foo (<< current_version)
|
| 21 |
- extend Provides: header with:
|
| 22 |
+ ${python:Provides} if your package is arch "any"
|
| 23 |
+ list of pythonX.Y-foo packages that external packages still depend on [1]
|
| 24 |
* remove python2.X-foo binary packages
|
| 25 |
|
| 26 |
2) debian/rules
|
| 27 |
|
| 28 |
* build modules for all python versions specified in XS-Python-Version, example rules:
|
| 29 |
PYVERS=$(shell pyversions -vr)
|
| 30 |
build: $(PYVERS:%=build-python%)
|
| 31 |
touch $@
|
| 32 |
build-python%:
|
| 33 |
python$* setup.py build
|
| 34 |
touch $@
|
| 35 |
install: build $(PYVERS:%=install-python%)
|
| 36 |
install-python%:
|
| 37 |
python$* setup.py install --root $(CURDIR)/debian/python-foo
|
| 38 |
* replace dh_python with dh_pycentral in binary rule
|
| 39 |
* If the public modules can't be shared, add
|
| 40 |
export DH_PYCENTRAL=nomove
|
| 41 |
at the top of debian/rules
|
| 42 |
* Egg support (optional):
|
| 43 |
- add "--single-version-externally-managed" option to setup.py install command
|
| 44 |
- remove python's version from Egg's dirname
|
| 45 |
- remove *-nspkg.pth file
|
| 46 |
|
| 47 |
3) debian/{postinst,prerm}
|
| 48 |
|
| 49 |
* remove unneeded postinst and prerm files, debhelper will generate them now
|
| 50 |
|
| 51 |
4) example packages
|
| 52 |
|
| 53 |
http://wiki.debian.org/DebianPython/NewPolicy#head-361ba69b3cd19d9b6bab84fbac6099268ddb3366
|
| 54 |
|
| 55 |
# package without .so files
|
| 56 |
apt-get source pyparallel
|
| 57 |
|
| 58 |
# package with .so files
|
| 59 |
apt-get source python-imaging
|
| 60 |
|
| 61 |
# package with .so files and Egg support
|
| 62 |
apt-get source pyenchant
|
| 63 |
|
| 64 |
5) useful links:
|
| 65 |
|
| 66 |
http://www.debian.org/doc/packaging-manuals/python-policy/
|
| 67 |
http://wiki.debian.org/DebianPython/NewPolicy
|
| 68 |
|
| 69 |
|
| 70 |
[1] remove that list as soon as external packages will depend on python-foo only
|