[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Fw: [Debian Wiki] Update of "Python/LibraryStyleGuide" by FedericoCeratto



I don't want to start a wiki war, but I'm not entirely happy with this
change.  I see that Piotr reverted part of it, but I want to revert the
removal of the d/rules stanza.  It's fine to have a link to the pybuild page,
and maybe we don't need the duplication, but I want LibraryStyleGuide to be a
one-stop shop for opinionated best practices for packaging (the most common)
Python stuff for Debian.

Federico, if you're on this list, can you explain why you made this change?
Was it just to reduce duplication with the pybuild page?

Cheers,
-Barry

Begin forwarded message:

Date: Sun, 15 Dec 2013 17:11:35 -0000
From: Debian Wiki <debian-www@lists.debian.org>
To: Debian Wiki <debian-www@lists.debian.org>
Subject: [Debian Wiki] Update of "Python/LibraryStyleGuide" by FedericoCeratto


Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Debian Wiki" for change notification.

The "Python/LibraryStyleGuide" page has been changed by FedericoCeratto:
https://wiki.debian.org/Python/LibraryStyleGuide?action=diff&rev1=32&rev2=33

  You'll want to have at least the following build dependencies:
  
   * debhelper (>= 8)
-  * dh-python
   * python-all (>= 2.6.6-3~)
   * python-setuptools
   * python3-all
   * python3-setuptools
  
- The {{{dh-python}}} dependency gets you {{{pybuild}}}.  The {{{python3-all}}} dependency is necessary if you're also going to build a Python 3 version, but you can drop that if upstream doesn't [[https://wiki.python.org/moin/PortingToPy3k/BilingualQuickRef|support Python 3]] yet.
+ The {{{python3-all}}} dependency is necessary if you're also going to build a Python 3 version, but you can drop that if upstream doesn't [[https://wiki.python.org/moin/PortingToPy3k/BilingualQuickRef|support Python 3]] yet.
+ 
+ And optionally:
+ 
+  * dh-python
+ 
+ The {{{dh-python}}} dependency gets you {{{pybuild}}}.
  
  Some other build dependencies you might want:
  
@@ -95, +100 @@

  
  == debian/rules ==
  
+ The configuration depends on the build system of choice.
+ See [[Python/Pybuild|pybuild]] for pybuild.
- Here is a {{{debian/rules}}} file for you to start with.  First, I'll show you the whole thing, then I'll explain it line by line.
- 
- {{{
- #!/usr/bin/make -f
- 
- #export DH_VERBOSE=1
- export PYBUILD_NAME=foo
- 
- %:
- 	dh $@ --with python2,python3 --buildsystem=pybuild
- }}}
- 
- The file starts with the standard {{{#!}}} line.  I like adding the (commented out when uploading) {{{DH_VERBOSE}}} line because it can make build problems easier to debug.
- 
- The next line is:
- 
- {{{
- export PYBUILD_NAME=foo
- }}}
- 
- pybuild supports a number of variables which can be used to control such things as the destination directory for build artifacts for both the Python 2 and Python 3 builds.  The defaults generally do the right thing, but you do need to at least tell pybuild the name of your package.  Here, we're telling it that the name is {{{foo}}}.  This should match the module name, so for example, in enum34, you'd see:
- 
- {{{
- export PYBUILD_NAME=enum34
- }}}
- 
- even though the binary packages that get produced are {{{python-enum34}}} and {{{python3-enum34}}}.
- 
- The next line is the standard debhelper-based catch-all rule which is used to get the whole build started:
- 
- {{{
- %:
- 	dh $@ --with python2,python3 --buildsystem=pybuild
- }}}
- 
- What's important to note here is that both of the {{{dh_python2}}} and {{{dh_python3}}} helpers are being invoked, and also that the ''build system'' that dh will use is pybuild.  There's a lot of magic packed into this line, and the pybuild manpage goes into more detail, but essentially what this does is:
- 
-  * Builds the Python 2 package for all supported Python 2 versions.
-  * Builds the Python 3 package for all supported Python 3 versions.
-  * Automatically detects the command to run the test suite.
-  * Runs the Python 2 test suite.
-  * Runs the Python 3 test suite.
- 
- Once all that's done, it properly installs all the files into binary packages.
- 
- If your package has Sphinx documentation, add the {{{sphinxdoc}}} helper like so:
- 
- {{{
- %:
- 	dh $@ --with python2,python3,sphinxdoc --buildsystem=pybuild
- }}}
- 
- If upstream does not yet support Python 3, omit the {{{python3}}} helper for now.
- 
- And that's it!  You usually won't need {{{debian/python-foo.install}}} or {{{debian/python3-foo.install}}} files even if you have multiple binary packages, because again, pybuild does the magic for you.  You might need these if there are some non-standard installation tricks you need to implement.
  
  == debian/*.links ==
  
@@ -158, +110 @@

  {{{
  usr/share/doc/python-foo/html/_sources usr/share/doc/python-foo/rst
  }}}
- 
- == debian/*.pyremove ==
- 
- Upstream source may install some files that you don't care about including in your Debian packages.  The way to handle this is by adding {{{debian/python-foo.pyremove}}} and {{{debian/python3-foo.pyremove}}} files.  For example:
- 
- {{{
- foo/conf.py
- foo/README.rst
- foo/NEWS.rst
- foo*.egg-info/SOURCES.txt
- }}}
- 
- ''TBD: better explanation of the rationale for removing these.''
  
  == debian/watch ==
  

Attachment: signature.asc
Description: PGP signature


Reply to: