Difference between revisions of "Python package guidelines"

From ArchWiki
Jump to: navigation, search
m (Examples)
Line 30: Line 30:
 
build() {
 
build() {
 
   cd $srcdir/$pkgname-$pkgver
 
   cd $srcdir/$pkgname-$pkgver
   python setup.py install --root=$pkgdir/ --optimize=1 || return 1
+
   python setup.py install --root=$pkgdir/ --optimize=1
  
 
   # Remember to install licenses if the license is not a common license!
 
   # Remember to install licenses if the license is not a common license!

Revision as of 21:49, 18 July 2010

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. 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/ --optimize=1

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

NOTE: The --optimize parameter compiles .pyo files so they can be tracked by pacman

In most cases, you should put any in the arch array since most Python packages are architecture independent.

Automation

-