Difference between revisions of "Python package guidelines"

From ArchWiki
Jump to: navigation, search
m
(Examples: added example)
Line 9: Line 9:
  
 
==Examples==
 
==Examples==
For examples, please take a look at the PKGBUILD-files for other Python packages.
+
Most python packages are installed using the ''distutils'' system using ''setup.py''. An example PKGBUILD is shown below
 +
 
 +
<pre>
 +
# Contributor: Your Name <youremail@domain.com>
 +
 
 +
pkgname=python-foo
 +
pkgver=VERSION
 +
pkgrel=1
 +
pkgdesc=""
 +
arch=(any)
 +
url=""
 +
license=()
 +
depends=('python')
 +
makedepends=()
 +
provides=()
 +
conflicts=()
 +
replaces=()
 +
backup=()
 +
options=(!emptydirs)
 +
install=
 +
 
 +
build() {
 +
  cd $srcdir/$pkgname-$pkgver
 +
  python setup.py install --root=$pkgdir/
 +
 
 +
  # Remember to install licenses if the license is not a common license!
 +
  # install -D -m644 $srcdir/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
 +
}
 +
 
 +
</pre>
 +
 
 +
In most cases, you should put '''any''' in the ''arch'' array since most Python packages are architecture independent. However if you intend to upload to the official repositories then you should use ''arch=(i686 x86_64)''.
  
 
==Example PKGBUILD==
 
==Example PKGBUILD==

Revision as of 12:18, 21 April 2009

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Python package guidelines#)

Package Naming

For libraries, use "python-modulename" or "pymodulename". For applications, use the program name. In either case, the pkgname should be entirely lowercase.

Examples

Most python packages are installed using the distutils system using setup.py. An example PKGBUILD is shown below

# Contributor: Your Name <youremail@domain.com>

pkgname=python-foo
pkgver=VERSION
pkgrel=1
pkgdesc=""
arch=(any)
url=""
license=()
depends=('python')
makedepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=(!emptydirs)
install=

build() {
  cd $srcdir/$pkgname-$pkgver
  python setup.py install --root=$pkgdir/

  # Remember to install licenses if the license is not a common license!
  # install -D -m644 $srcdir/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

In most cases, you should put any in the arch array since most Python packages are architecture independent. However if you intend to upload to the official repositories then you should use arch=(i686 x86_64).

Example PKGBUILD

-

Automation

-