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