pimp
index
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/pimp.py
Module Docs

Package Install Manager for Python.
 
This is currently a MacOSX-only strawman implementation.
Despite other rumours the name stands for "Packman IMPlementation".
 
Tools to allow easy installation of packages. The idea is that there is
an online XML database per (platform, python-version) containing packages
known to work with that combination. This module contains tools for getting
and parsing the database, testing whether packages are installed, computing
dependencies and installing packages.
 
There is a minimal main program that works as a command line tool, but the
intention is that the end user will use this through a GUI.

 
Modules
       
distutils
hashlib
os
plistlib
shutil
subprocess
sys
tarfile
tempfile
time
urllib
urllib2
urlparse

 
Classes
       
PimpDatabase
PimpPackage
PimpPreferences

 
class PimpDatabase
    Class representing a pimp database. It can actually contain
information from multiple databases through inclusion, but the
toplevel database is considered the master, as its maintainer is
"responsible" for the contents.
 
  Methods defined here:
__init__(self, prefs)
appendURL(self, url, included=0)
Append packages from the database with the given URL.
Only the first database should specify included=0, so the
global information (maintainer, description) get stored.
close(self)
Clean up
description(self)
dump(self, pathOrFile)
Dump the contents of the database to an XML .plist file.
 
The file can be passed as either a file object or a pathname.
All data, including included databases, is dumped.
find(self, ident)
Find a package. The package can be specified by name
or as a dictionary with name, version and flavor entries.
 
Only name is obligatory. If there are multiple matches the
best one (higher version number, flavors ordered according to
users' preference) is returned.
list(self)
Return a list of all PimpPackage objects in the database.
listnames(self)
Return a list of names of all packages in the database.
maintainer(self)
url(self)
# Accessor functions
version(self)

 
class PimpPackage
    Class representing a single package.
 
  Methods defined here:
__cmp__(self, other)
Compare two packages, where the "better" package sorts lower.
__getitem__(self, key)
__init__(self, db, plistdata)
afterInstall(self)
Bookkeeping after installation: interpret any new .pth files that have
appeared
beforeInstall(self)
Bookkeeping before installation: remember what we have in site-packages
description(self)
downloadPackageOnly(self, output=None)
Download a single package, if needed.
 
An MD5 signature is used to determine whether download is needed,
and to test that we actually downloaded what we expected.
If output is given it is a file-like object that will receive a log
of what happens.
 
If anything unforeseen happened the method returns an error message
string.
downloadURL(self)
dump(self)
Return a dict object containing the information on the package.
filterExpectedSkips(self, names)
Return a list that contains only unpexpected skips
flavor(self)
fullname(self)
Return the full name "name-version-flavor" of a package.
 
If the package is a pseudo-package, something that cannot be
installed through pimp, return the name in (parentheses).
homepage(self)
installPackageOnly(self, output=None)
Default install method, to be overridden by subclasses
installSinglePackage(self, output=None)
Download, unpack and install a single package.
 
If output is given it should be a file-like object and it
will receive a log of what happened.
installed(self)
Test wheter the package is installed.
 
Returns two values: a status indicator which is one of
"yes", "no", "old" (an older version is installed) or "bad"
(something went wrong during the install test) and a human
readable string which may contain more details.
name(self)
prerequisites(self)
Return a list of prerequisites for this package.
 
The list contains 2-tuples, of which the first item is either
PimpPackage object or None, and the second is a descriptive
string. The first item can be None if this package depends on
something that isn't pimp-installable, in which case the descriptive
string should tell the user what to do.
shortdescription(self)
systemwideOnly(self)
unpackPackageOnly(self, output=None)
Unpack a downloaded package archive.
version(self)

 
class PimpPreferences
    Container for per-user preferences, such as the database to use
and where to install packages.
 
  Methods defined here:
__init__(self, flavorOrder=None, downloadDir=None, buildDir=None, installDir=None, pimpDatabase=None)
check(self)
Check that the preferences make sense: directories exist and are
writable, the install directory is on sys.path, etc.
compareFlavors(self, left, right)
Compare two flavor strings. This is part of your preferences
because whether the user prefers installing from source or binary is.
isUserInstall(self)
setInstallDir(self, installDir=None)
setWatcher(self, watcher)

 
Functions
       
getDefaultDatabase(experimental=False)
main()
Minimal commandline tool to drive pimp.

 
Data
        PIMP_VERSION = '0.5'
__all__ = ['PimpPreferences', 'PimpDatabase', 'PimpPackage', 'main', 'getDefaultDatabase', 'PIMP_VERSION', 'main']