bzr branch
https://alioth.debian.org/scm/loggerhead/pkg-python/python-defaults-debian
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
1 |
============
|
2 |
dh_python2
|
|
3 |
============
|
|
4 |
||
5 |
-----------------------------------------------------------------------------------
|
|
6 |
calculates Python dependencies, adds maintainer scripts to byte compile files, etc.
|
|
7 |
-----------------------------------------------------------------------------------
|
|
8 |
||
|
360
by Matthias Klose
* Drop Python 2.6 as a supported Python version. |
9 |
:Manual section: 1 |
10 |
:Author: Piotr Ożarowski, 2012-2013 |
|
11 |
||
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
12 |
SYNOPSIS
|
13 |
========
|
|
14 |
dh_python2 -p PACKAGE [-V [X.Y][-][A.B]] DIR_OR_FILE [-X REGEXPR] |
|
15 |
||
16 |
DESCRIPTION
|
|
17 |
===========
|
|
18 |
||
19 |
QUICK GUIDE FOR MAINTAINERS
|
|
20 |
---------------------------
|
|
21 |
||
22 |
* if necessary, describe supported Python versions via X-Python-Version field
|
|
23 |
in debian/control, |
|
24 |
* build-depend on python or python-all or python-all-dev (>= 2.6.6-3~),
|
|
25 |
* build module/application using its standard build system,
|
|
26 |
remember to build extensions for all supported Python versions (loop over |
|
27 |
``pyversions -vr``),
|
|
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
28 |
* install files to the *standard* locations, add `--install-layout=deb` to |
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
29 |
setup.py's install command if your package is using distutils, |
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
30 |
* add `python2` to dh's --with option, or: |
31 |
* `include /usr/share/cdbs/1/class/python-distutils.mk` in debian/rules and |
|
32 |
depend on `cdbs (>= 0.4.90)`, or:
|
|
33 |
* call ``dh_python2`` in the `binary-*` target, |
|
34 |
* add `${python:Depends}` to Depends |
|
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
35 |
|
36 |
NOTES
|
|
37 |
-----
|
|
38 |
||
39 |
In order to support more than one Python version in the same binary package, |
|
40 |
dh_python2 (unlike dh_pycentral and dh_pysupport) creates symlinks to all |
|
41 |
supported Python versions at build time. It means binNMU (or sourceful upload |
|
|
190
by Piotr Ożarowski
dh_python2 and pycompile: read /usr/share/python/debian_defaults to get |
42 |
in case of architecture independent packages) is required once a list of |
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
43 |
supported Python version is changed. It's faster and more robust than its |
44 |
competitors, though. |
|
45 |
||
|
243
by Piotr Ożarowski
add a note about private directories |
46 |
dependencies
|
|
245
by Piotr Ożarowski
s/-/~/ in NOTES' subsection titles |
47 |
~~~~~~~~~~~~
|
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
48 |
dh_python2 tries to translate Python dependencies from requires.txt file to |
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
49 |
Debian dependencies. Use debian/pydist-overrides or --no-guessing-deps option |
50 |
to override it if the guess is incorrect. If you want dh_python2 to generate |
|
51 |
more strict dependencies (f.e. to avoid ABI problems) create |
|
52 |
debian/python-foo.pydist file. See /usr/share/doc/python-doc/README.PyDist |
|
53 |
(provided by python-doc package) for more information. If the pydist file |
|
54 |
contains PEP386 flag or set of (uscan like) rules, dh_python2 will make the |
|
55 |
depedency versioned (version requirements are ignored by default). |
|
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
56 |
|
|
243
by Piotr Ożarowski
add a note about private directories |
57 |
namespace feature
|
|
245
by Piotr Ożarowski
s/-/~/ in NOTES' subsection titles |
58 |
~~~~~~~~~~~~~~~~~
|
|
210
by Piotr Ożarowski
dh_python2, pycompile, pyclean: add "namespace" feature: |
59 |
dh_python2 parses Egg's namespace_packages.txt files (in addition to |
60 |
--namespace command line argument(s)) and drops empty __init__.py files from |
|
|
305.1.1
by Piotr Ożarowski
typo fixed |
61 |
binary package. pycompile will regenerate them at install time and pyclean |
|
210
by Piotr Ożarowski
dh_python2, pycompile, pyclean: add "namespace" feature: |
62 |
will remove them at uninstall time (if they're no longer used in installed |
|
243
by Piotr Ożarowski
add a note about private directories |
63 |
packages). It's still a good idea to provide __init__.py file in one of |
64 |
binary packages (even if all other packages use this feature). |
|
65 |
||
66 |
private dirs
|
|
|
245
by Piotr Ożarowski
s/-/~/ in NOTES' subsection titles |
67 |
~~~~~~~~~~~~
|
|
244
by Piotr Ożarowski
describe .pyinstall and .pyremove files in dh_python2's manpage |
68 |
`/usr/share/foo`, `/usr/share/games/foo`, `/usr/lib/foo` and |
69 |
`/usr/lib/games/foo` private directories are scanned for Python files
|
|
70 |
by default (where `foo` is binary package name). If your package is shipping
|
|
71 |
Python files in some other directory, add another dh_python2 call in |
|
72 |
debian/rules with directory name as an argument - you can use different set of |
|
73 |
options in this call. If you need to change options (f.e. a list of supported |
|
74 |
Python versions) for a private directory that is checked by default, invoke |
|
75 |
dh_python2 with --skip-private option and add another call with a path to this |
|
76 |
directory and new options. |
|
77 |
||
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
78 |
debug packages
|
79 |
~~~~~~~~~~~~~~
|
|
80 |
In binary packages which name ends with `-dbg`, all files in
|
|
81 |
`/usr/lib/python2.X/{site,dist}-packages/` directory
|
|
82 |
that have extensions different than `so` or `h` are removed by default. |
|
83 |
Use --no-dbg-cleaning option to disable this feature. |
|
84 |
||
|
244
by Piotr Ożarowski
describe .pyinstall and .pyremove files in dh_python2's manpage |
85 |
pyinstall files
|
|
245
by Piotr Ożarowski
s/-/~/ in NOTES' subsection titles |
86 |
~~~~~~~~~~~~~~~
|
|
244
by Piotr Ożarowski
describe .pyinstall and .pyremove files in dh_python2's manpage |
87 |
Files listed in debian/pkg.pyinstall file will be installed as public modules |
88 |
for all requested Python versions (dh_install doesn't know about python's site- |
|
89 |
vs. dist-packages issue). |
|
90 |
||
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
91 |
Syntax: ``path/to/file [VERSION_RANGE] [NAMESPACE]``
|
92 |
||
93 |
debian directory is automatically removed from the path, so you can place your |
|
94 |
files in debian/ directory and install them from this location (if you want to |
|
95 |
install them in "debian" namespace, set NAMESPACE to debian). If NAMESPACE is |
|
96 |
set, all listed files will be installed in .../dist-packages/NAMESPACE/ |
|
97 |
directory. |
|
|
244
by Piotr Ożarowski
describe .pyinstall and .pyremove files in dh_python2's manpage |
98 |
|
99 |
Examples: |
|
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
100 |
* ``foo.py`` installs .../dist-packages/foo.py for all supported Python versions
|
101 |
* ``foo/bar.py 2.6-`` installs .../dist-packages/foo/bar.py for versions >= 2.6 |
|
102 |
* ``foo/bar.py spam`` installs .../dist-packages/spam/bar.py |
|
103 |
* ``debian/*.py spam.egg 2.5`` installs .../python2.5/site-packages/spam/egg/\*.py |
|
104 |
files |
|
|
244
by Piotr Ożarowski
describe .pyinstall and .pyremove files in dh_python2's manpage |
105 |
|
106 |
pyremove files
|
|
|
245
by Piotr Ożarowski
s/-/~/ in NOTES' subsection titles |
107 |
~~~~~~~~~~~~~~
|
|
244
by Piotr Ożarowski
describe .pyinstall and .pyremove files in dh_python2's manpage |
108 |
If you want to remove some files installed by build system (from all supported |
109 |
Python versions or only from a subset of these versions), add them to |
|
110 |
debian/pkg.pyremove file. |
|
111 |
||
112 |
Examples: |
|
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
113 |
* ``*.pth`` removes .pth files from .../dist-packages/ |
114 |
* ``bar/baz.py 2.5`` removes .../python2.5/site-packages/bar/baz.py
|
|
|
243
by Piotr Ożarowski
add a note about private directories |
115 |
|
|
321
by Piotr Ożarowski
add information about overriging list of supported Python versions |
116 |
overriding supported / default Python versions
|
117 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
118 |
If you want to override system's list of supported Python versions or the |
|
119 |
default one (f.e. to build a package that includes symlinks for older version |
|
120 |
of Python or compile .py files only for given interpreter version), you can do |
|
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
121 |
that via `DEBPYTHON_SUPPORTED` and/or `DEBPYTHON_DEFAULT` env. variables. |
|
321
by Piotr Ożarowski
add information about overriging list of supported Python versions |
122 |
|
|
328
by Piotr Ożarowski
Improve dh_python2 manpage a bit, add information about cleaning debug |
123 |
Example: ``2.5,2.7`` limits the list of supported Python versions to Python 2.5
|
|
321
by Piotr Ożarowski
add information about overriging list of supported Python versions |
124 |
and Python 2.7. |
125 |
||
|
210
by Piotr Ożarowski
dh_python2, pycompile, pyclean: add "namespace" feature: |
126 |
|
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
127 |
OPTIONS
|
128 |
=======
|
|
129 |
--version show program's version number and exit |
|
130 |
||
131 |
-h, --help show help message and exit |
|
132 |
||
133 |
--no-guessing-versions disable guessing other supported Python versions |
|
134 |
||
135 |
--no-guessing-deps disable guessing dependencies |
|
136 |
||
|
259
by Piotr Ożarowski
add --no-dbg-cleaning option (to disable removing files from debug |
137 |
--no-dbg-cleaning do not remove any files from debug packages |
138 |
||
|
317
by Piotr Ożarowski
* dh_python2: |
139 |
--no-shebang-rewrite do not rewrite shebangs |
140 |
||
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
141 |
--skip-private don't check private directories |
142 |
||
143 |
-v, --verbose turn verbose mode on |
|
144 |
||
145 |
-i, --indep act on architecture independent packages |
|
146 |
||
147 |
-a, --arch act on architecture dependent packages |
|
148 |
||
149 |
-q, --quiet be quiet |
|
150 |
||
151 |
-p PACKAGE, --package=PACKAGE act on the package named PACKAGE |
|
152 |
||
153 |
-N NO_PACKAGE, --no-package=NO_PACKAGE do not act on the specified package |
|
154 |
||
155 |
-V VRANGE specify list of supported Python versions. See |
|
156 |
pycompile(1) for examples |
|
157 |
||
158 |
-X REGEXPR, --exclude=REGEXPR exclude items that match given REGEXPR. You may |
|
159 |
use this option multiple times to build up a list of things to exclude. |
|
160 |
||
|
258
by Piotr Ożarowski
* dh_python2: |
161 |
--compile-all compile all files from given private directory in postinst/rtupdate |
162 |
not just the ones provided by the package (i.e. do not pass the --package |
|
163 |
parameter to pycompile/pyclean) |
|
164 |
||
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
165 |
--depends=DEPENDS translate given requirements into Debian dependencies |
166 |
and add them to ${python:Depends}. Use it for missing items in requires.txt
|
|
167 |
||
168 |
--recommends=RECOMMENDS translate given requirements into Debian dependencies |
|
169 |
and add them to ${python:Recommends}
|
|
170 |
||
171 |
--suggests=SUGGESTS translate given requirements into Debian dependencies |
|
172 |
and add them to ${python:Suggests}
|
|
173 |
||
|
210
by Piotr Ożarowski
dh_python2, pycompile, pyclean: add "namespace" feature: |
174 |
--namespace use this option (multiple time if necessary) if |
175 |
namespace_packages.txt is not complete |
|
176 |
||
|
231
by Piotr Ożarowski
add --ignore-namespace option that will disable handling |
177 |
--ignore-namespace ignore Egg's namespace declaration and |
178 |
--namespace option. This option will disable removing (and recreating at |
|
179 |
install time) empty __init__.py files. Removing namespace_packages.txt from |
|
180 |
egg-info directory has the same effect. |
|
181 |
||
|
223
by Piotr Ożarowski
dh_python2: no longer generates maintainer scripts that invoke pycentral's |
182 |
--clean-pycentral generate maintainer script that will remove byte code |
183 |
generated by python-central helper |
|
184 |
||
|
317
by Piotr Ożarowski
* dh_python2: |
185 |
--shebang=COMMAND use given command as shebang in scripts |
186 |
||
|
230
by Piotr Ożarowski
add --ignore-shebangs option that will disable translating shebangs into |
187 |
--ignore-shebangs do not translate shebangs into Debian dependencies |
188 |
||
|
189
by Piotr Ożarowski
rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured |
189 |
SEE ALSO
|
190 |
========
|
|
191 |
* /usr/share/doc/python/python-policy.txt.gz
|
|
192 |
* /usr/share/doc/python-doc/README.PyDist (python-doc package)
|
|
193 |
* pycompile(1), pyclean(1)
|
|
194 |
* dh_python3(1), py3compile(1), py3clean(1)
|
|
|
272
by Piotr Ożarowski
update TransitionToDHPython2 wiki URL |
195 |
* Wiki page about converting package to dh_python2:
|
196 |
http://wiki.debian.org/Python/TransitionToDHPython2 |