Merge lp:~mitya57/ubuntu-packaging-guide/goodbye-python-packaging-page into lp:ubuntu-packaging-guide

Proposed by Dmitry Shachnev
Status: Merged
Merged at revision: 530
Proposed branch: lp:~mitya57/ubuntu-packaging-guide/goodbye-python-packaging-page
Merge into: lp:ubuntu-packaging-guide
Diff against target: 225 lines (+17/-149)
4 files modified
debian/changelog (+4/-0)
ubuntu-packaging-guide/index.rst (+3/-2)
ubuntu-packaging-guide/packaging-new-software.rst (+10/-5)
ubuntu-packaging-guide/python-packaging.rst (+0/-142)
To merge this branch: bzr merge lp:~mitya57/ubuntu-packaging-guide/goodbye-python-packaging-page
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Review via email: mp+218282@code.launchpad.net

Description of the change

Remove Python Packaging page in favour of a link to Debian wiki.

That page was written in 2012, and since then many things happened in
Python world, like PyBuild and deprecation of Python 2.

The Debian wiki is kept up-to-date, while we are not in sync.

This also updates information about running Lintian (and mentions Lintian4Python where needed).

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

Thanks. Good work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-05-05 10:24:17 +0000
3+++ debian/changelog 2014-05-05 13:30:54 +0000
4@@ -3,6 +3,10 @@
5 [ Dmitry Shachnev ]
6 * Fix a typo and regenerate the .pot file (LP: #1309861).
7 * Use anonymous links where possible to make translation easier.
8+ * Add more information about Lintian.
9+ * Remove Python Packaging page in favour of a link from index page
10+ to Debian wiki. Our guide is terribly outdated, while Debian’s one
11+ is kept up-to-date.
12
13 [ Daniel Holbach ]
14 * Changed "phone and table" to "phone and tablet".
15
16=== modified file 'ubuntu-packaging-guide/index.rst'
17--- ubuntu-packaging-guide/index.rst 2014-05-03 17:19:42 +0000
18+++ ubuntu-packaging-guide/index.rst 2014-05-05 13:30:54 +0000
19@@ -85,7 +85,6 @@
20 udd-merging
21 chroots
22 traditional-packaging
23- python-packaging
24 kde
25
26 Further Reading
27@@ -100,7 +99,8 @@
28 * `How to package for Debian <HowToPackage_>`_;
29 * `Debian Policy Manual <Policy_>`_;
30 * `Debian New Maintainers' Guide <NewMaintGuide_>`_ — available in many languages;
31-* `Packaging tutorial <PkgTutorial_>`_ (also available as a `package <PkgTutorialPkg_>`_).
32+* `Packaging tutorial <PkgTutorial_>`_ (also available as a `package <PkgTutorialPkg_>`_);
33+* `Guide for Packaging Python Modules <PythonModules_>`_.
34
35 We are always looking to improve this guide. If you find any problems or have
36 some suggestions, please `report a bug on Launchpad <Bugs_>`_.
37@@ -114,3 +114,4 @@
38 .. _PkgTutorialPkg: https://launchpad.net/ubuntu/+source/packaging-tutorial
39 .. _Bugs: https://bugs.launchpad.net/ubuntu-packaging-guide
40 .. _Source: https://code.launchpad.net/~ubuntu-packaging-guide-team/ubuntu-packaging-guide/trunk
41+.. _PythonModules: https://wiki.debian.org/Python/LibraryStyleGuide
42
43=== modified file 'ubuntu-packaging-guide/packaging-new-software.rst'
44--- ubuntu-packaging-guide/packaging-new-software.rst 2014-05-03 17:19:42 +0000
45+++ ubuntu-packaging-guide/packaging-new-software.rst 2014-05-05 13:30:54 +0000
46@@ -156,14 +156,20 @@
47
48 Even if it builds the .deb binary package, your packaging may have
49 bugs. Many errors can be automatically detected by our tool
50-``lintian`` which can be run on both the source .dsc metadata file and
51-the .deb binary package::
52+``lintian`` which can be run on the source .dsc metadata file, .deb
53+binary packages or .changes file::
54
55 $ lintian hello_2.7-0ubuntu1.dsc
56 $ lintian hello_2.7-0ubuntu1_amd64.deb
57
58-A description of each of the problems it reports can be found on the
59-`lintian website <Lintian_>`_.
60+To see verbose description of the problems use ``--info`` lintian flag
61+or ``lintian-info`` command.
62+
63+Results of Ubuntu archive checks can be found online on
64+http://lintian.ubuntuwire.org.
65+
66+For Python packages, there is also a ``lintian4python`` tool that provides
67+some additional lintian checks.
68
69 After making a fix to the packaging you can rebuild using ``-nc`` "no clean"
70 without having to build from scratch::
71@@ -237,7 +243,6 @@
72 .. _PPA: https://help.launchpad.net/Packaging/PPA
73 .. _GNU.org: http://www.gnu.org/software/hello/
74 .. _`packages.ubuntu.com`: http://packages.ubuntu.com/
75-.. _Lintian: http://lintian.debian.org/tags.html
76 .. _ubuntu-motu: https://lists.ubuntu.com/mailman/listinfo/ubuntu-motu
77 .. _MentorsFAQ: https://wiki.debian.org/DebianMentorsFaq
78 .. _WNPP: http://www.debian.org/devel/wnpp/
79
80=== removed file 'ubuntu-packaging-guide/python-packaging.rst'
81--- ubuntu-packaging-guide/python-packaging.rst 2012-10-16 12:17:54 +0000
82+++ ubuntu-packaging-guide/python-packaging.rst 1970-01-01 00:00:00 +0000
83@@ -1,142 +0,0 @@
84-=========================================
85-Packaging Python modules and applications
86-=========================================
87-
88-Our packaging follows Debian’s `Python policy`_. We will use the `python-markdown`_ package as an example, which can be downloaded from `PyPI`_. You can look at its packaging at its `Subversion repository`_.
89-
90-There are two types of Python packages — *modules* and *apps*.
91-
92-At the time of writing, Ubuntu has two incompatible versions of Python — *2.x* and *3.x*. ``/usr/bin/python`` is a symbolic link to a default Python 2.x version, and ``/usr/bin/python3`` — to a default Python 3.x version. Python modules should be built against all supported Python versions.
93-
94-If you are going to package a new Python module, you might find the ``py2dsc`` tool useful (available in `python-stdeb`_ package).
95-
96-debian/control
97---------------
98-
99-Python 2.x and 3.x versions of the package should be in separate binary packages. Names should have ``python{,3}-modulename`` format (like: ``python3-dbus.mainloop.qt``). Here, we will use ``python-markdown`` and ``python3-markdown`` for module packages and ``python-markdown-doc`` for the documentation package.
100-
101-Things in ``debian/control`` that are specific for a Python package:
102-
103-- The section of module packages should be ``python``, and ``doc`` for the documentation package. For an application, a single binary package will be enough.
104-- We should add build dependencies on ``python-all (>= 2.6.6-3~)`` and ``python3-all (>= 3.1.2-7~)`` to make sure Python helpers are available (see the next section for details).
105-- It’s recommended to add ``X-Python-Version`` and ``X-Python3-Version`` fields — see “`Specifying Supported Versions`_” section of the Policy for details. For example::
106-
107- X-Python-Version: >= 2.6
108- X-Python3-Version: >= 3.1
109-
110- If your package works only with Python 2.x or 3.x, build depend only on one ``-all`` package and use only one ``-Version`` field.
111-- Module packages should have ``{python:Depends}`` and ``{python3:Depends}`` substitution variables (respectively) in their dependency lists.
112-
113-debian/rules
114-------------
115-
116-The recommended helpers for python modules are ``dh_python2`` and ``dh_python3``. Unfortunately, ``debhelper`` doesn’t yet build Python 3.x packages automatically (see `bug 597105`_ in Debian BTS), so we’ll need to do that manually in override sections (skip this if your package doesn’t support Python 3.x).
117-
118-Here’s our ``debian/rules`` file (with annotations):
119-
120-.. code-block:: makefile
121-
122- # These commands build the list of supported Python 3 versions
123- # The last version should be just “python3” so that the scripts
124- # get a correct shebang.
125- # Use just “PYTHON3 := $(shell py3versions -r)” if your package
126- # doesn’t contain scripts
127- PY3REQUESTED := $(shell py3versions -r)
128- PY3DEFAULT := $(shell py3versions -d)
129- PYTHON3 := $(filter-out $(PY3DEFAULT),$(PY3REQUESTED)) python3
130-
131- %:
132- # Adding the required helpers
133- dh $@ --with python2,python3
134-
135- override_dh_auto_clean:
136- dh_auto_clean
137- rm -rf build/
138-
139- override_dh_auto_build:
140- # Build for each Python 3 version
141- set -ex; for python in $(PYTHON3); do \
142- $$python setup.py build; \
143- done
144- dh_auto_build
145-
146- override_dh_auto_install:
147- # The same for install; note the --install-layout=deb option
148- set -ex; for python in $(PYTHON3); do \
149- $$python setup.py install --install-layout=deb --root=debian/tmp; \
150- done
151- dh_auto_install
152-
153-It is also a good practice to run tests during the build, if they are shipped by upstream. Usually tests can be invoked using ``setup.py test`` or ``setup.py check``.
154-
155-debian/\*.install
156------------------
157-
158-Python 2.x modules are installed into ``/usr/share/pyshared/`` directory, and symbolic links are created in ``/usr/lib/python2.x/dist-packages/`` for every interpreter version, while Python 3.x ones are all installed into ``/usr/lib/python3/dist-packages/``.
159-
160-If your package is an application and has private Python modules, they should be installed in ``/usr/share/module``, or ``/usr/lib/module`` if the modules are architecture-dependent (e.g. extensions) (see “`Programs Shipping Private Modules`_” section of the Policy).
161-
162-So, our ``python-markdown.install`` file will look like this (we’ll also want to install a ``markdown_py`` executable)::
163-
164- usr/lib/python2.*/
165- usr/bin/
166-
167-and ``python3-markdown.install`` will only have one line::
168-
169- usr/lib/python3/
170-
171-The ``-doc`` package
172---------------------
173-
174-The tool most commonly used for building Python docs is `Sphinx`_. To add Sphinx documentation to your package (using ``dh_sphinxdoc`` helper), you should:
175-
176-* Add a build-dependency on ``python-sphinx`` or ``python3-sphinx`` (depending on what Python version do you want to use);
177-* Append ``sphinxdoc`` to the ``dh --with`` line;
178-* Run ``setup.py build_sphinx`` in ``override_dh_auto_build`` (sometimes not needed);
179-* Add ``{sphinxdoc:Depends}`` to the dependency list of your ``-doc`` package;
180-* Add the path of the built docs directory (usually ``build/sphinx/html``) to your ``.docs`` file.
181-
182-In our case, the docs are automatically built in ``build/docs/`` directory when we run ``setup.py build``, so we can simply put this in the ``python-markdown-doc.docs`` file::
183-
184- build/docs/
185-
186-Because docs also contain source ``.txt`` files, we’ll also tell ``dh_compress`` to not compress them — by adding this to ``debian/rules``:
187-
188-.. code-block:: makefile
189-
190- override_dh_compress:
191- dh_compress -X.txt
192-
193-Checking for packaging mistakes
194--------------------------------
195-
196-Along with ``lintian``, there is a special tool for checking Python packages — ``lintian4py``. It is available in the `lintian4python`_ package. For example, these two commands invoke both versions of ``lintian`` and check source and binary packages::
197-
198- lintian -EI --pedantic *.dsc *.deb
199- lintian4py -EI --pedantic *.dsc *.deb
200-
201-Here, ``-EI`` option is used to enable experimental and informational tags.
202-
203-See also
204---------
205-
206-* The `Python policy`_;
207-* `Python/Packaging`_ article on Debian wiki;
208-* `Python/LibraryStyleGuide`_ and `Python/AppStyleGuide`_ articles on Debian wiki;
209-* Debian `python-modules`_ and `python-apps`_ teams.
210-
211-.. _`Python policy`: http://www.debian.org/doc/packaging-manuals/python-policy/
212-.. _`python-markdown`: http://packages.python.org/Markdown/
213-.. _`PyPI`: http://pypi.python.org/pypi/Markdown/
214-.. _`Subversion repository`: http://anonscm.debian.org/viewvc/python-modules/packages/python-markdown/trunk/debian/
215-.. _`python-stdeb`: https://launchpad.net/ubuntu/+source/stdeb
216-.. _`bug 597105`: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597105
217-.. _`Specifying Supported Versions`: http://www.debian.org/doc/packaging-manuals/python-policy/ch-module_packages.html#s-specifying_versions
218-.. _`Programs Shipping Private Modules`: http://www.debian.org/doc/packaging-manuals/python-policy/ch-programs.html#s-current_version_progs
219-.. _`Sphinx`: http://sphinx.pocoo.org/
220-.. _`lintian4python`: https://launchpad.net/ubuntu/+source/lintian4python
221-.. _`Python/Packaging`: http://wiki.debian.org/Python/Packaging
222-.. _`Python/LibraryStyleGuide`: http://wiki.debian.org/Python/LibraryStyleGuide
223-.. _`Python/AppStyleGuide`: http://wiki.debian.org/Python/AppStyleGuide
224-.. _`python-modules`: http://wiki.debian.org/Teams/PythonModulesTeam/
225-.. _`python-apps`: http://wiki.debian.org/Teams/PythonAppsPackagingTeam/

Subscribers

People subscribed via source and target branches