Libpypac

About

Libpypac is a package management library framework that aims on beeing 100% compatible with Archlinux' default package manager Pacman, written in Python.

Table Of Contents

  1. News
  2. License
  3. Download
    1. Stable
    2. Devel
  4. Documentation
    1. Installation
    2. Apport
    3. Overview
    4. Terminology
    5. Philosophy
  5. Frontends
    1. Paclet
  6. Development
    1. Coding Rules
    2. Maintainers
    3. Contributors
  7. FAQ

News

News and lots of other stuff can be found on the projectpage at gna.org.

License

Libpypac is distributed under GNU Lesser General Public License (LGPL) which means that you can distribute your frontends under whatever license you wish.

Download

Stable

Latest stable release of Libpypac can be found here.
Latest stable release of Lazy-pac-CLI can be found here.

Devel

Snapshots of Libpypac-Devel can be found here.
Snapshots of Lazy-Pac-CLI-Devel can be found here.

To get the source from Subversion:

svn co http://svn.gna.org/svn/libpypac/trunk libpypac

Documentation

Installation

Install from a tarball:

tar xvzf libpypac-<version>.tar.gz cd libpypac-<version> # As root python ./setup.py install
Install from Subversion:
svn co http://svn.gna.org/svn/libpypac/trunk libpypac cd libpypac/libpypac_devel # As root python ./setup.py install

Apport

Apport is a simple console frontend prototype used for testing Libpypac. It should explain how most things could be done in real code and it's Public Domain so feel free to copy and past from it.

Overview

Libpypac contains five files:

  1. libpypac_0.py : Contains reading configuration, syncing mirrors, download and md5sum functions.
  2. libpypac_1.py : Contains search, database and cache functions.
  3. libpypac_2.py : Contains update and install functions.
  4. libpypac_3.py : Contains remove functions.
  5. libpypac_misc.py : Contains miscellaneous functions used internally by the other files.
Libpypac installs under 'site-packages/libpypac' and Libpypac-Devel under 'site-packages/libpypac_devel' so they does not conflict. Lazy-Pac-CLI uses the equivalent layout as well.

Terminology

Package : eg 'mozilla-firefox-1.0.6-3', <name>-<ver>-<rel>
Name : a package name, eg 'mozilla-firefox'
Ver : a package version, eg '1.0.6'
Rel : a package rel, eg '3'
Reason : '0' if a package was explicitly installed and '1' if as a dependency
Server : eg 'ftp://ftp.archlinux.org/current/os/i686'
Repo : eg 'current'
Host : eg 'ftp.archlinux.org'

Philosophy

Libpypac is built up by many small functions instead of fewer big ones. That means that it gets a tad more difficult to write frontends but instead you can tweak and customize until perfection.

Frontends

Paclet

Paclet is a desklet that checks for updates and a little other stuff, written by Cameron Daniel (cs-cam). It's also listed at adesklets homepage.

Development

Coding Rules

  1. No tabs allowed.
  2. Use two spaces indentation if possible.
  3. Use only lower-cases.
  4. Use doc-strings as shown in the following example:
    def foo(bar_0, bar_1): """Counts the chars of the function variables. Vars: 0. An object that is countable with len 1. An object that is countable with len Returns: 0. The length of the first variable as integer 1. The length of the second variable as integer""" return len(bar_0), len(bar_1)
    It should look like this in a terminal:
    >>> print foo.__doc__ Counts the chars of the function variables. Vars: 0. An object that is countable with len 1. An object that is countable with len Returns: 0. The length of the first variable as integer 1. The length of the second variable as integer
  5. Don't return integers if you don't have to.
  6. Include a whitespace between chars when possible, except for commas, they should only have one after.
  7. Don't use classes (This may change in the future.).
  8. Try to make the names logical, eg bar_str, bar_list, bar_int, bar_dict and so forth when it make sense.
  9. Use only 7-bit us-ascii.

Maintainers

Jens Persson (xerxes2) <xerxes2 at gmail dot com>
Christian Lundgren (lunke) <zeflunk at gmail dot com>
Stefano Esposito (ragnarok) <ragnarok at email dot it>

Contributors

FAQ

Q: Why is Libpypac written in Python?

A: Because it's the only language I know, well.


Q: Why can't I use tabs in Libpypac?

A: Because tabs are pure evil in Python. It will just end up in tears if people start mixing tabs and spaces.