Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.

Adding Packages

pgjones edited this page Jul 31, 2012 · 1 revision

Package Versions and Registration

Snoing allows multiple versions of the same package with each version being a separate class. All packages including each version are automatically loaded by snoing from the versions folder. Hence for a package to be registered in snoing it must be defined in the versions folder.

Note however that typically different versions of a package will share much of the same code to install it, hence the packages folder contains the shared version independent code.

Package Type

Snoing packages are split into two broad types, those that can be installed locally LocalPackages and those that must be (or are best) installed on the system SystemPackages. When adding a new package you must first decide what type it is.

System Packages

System packages are further specialised into LibraryPackage and ComandPackage, the former will search the system for a library and try to link whilst the latter will attempt to run a command. New packages can easily extend these and usually only require a correct constructor (or __init__).

Local Packages

Local packages i.e. those that can and will be installed to the install folder by snoing must extend LocalPackage and have the following functions defined:

def GetDependencies( self ):
        """ Return the dependency names as a list of names."""
        pass
    def _IsDownloaded( self ):
        """ Check if package is downloaded."""
        return False
    def _IsInstalled( self ):
        """ Check if package is installed."""
        return False
    def _Download( self ):
        """ Derived classes should override this to download the package.."""
        pass
    def _Install( self ):
        """ Derived classes should override this to install the package, should install only when finished."""
        pass

It is advised that the packages make extensive use of the PackageUtil functions.

Packages with dependencies

To make a package dependent on another, simply add the package name to the list of dependencies returned by the GetDependencies method. For example this is the standard list of root dependencies:

[ "make", "g++", "gcc", "ld", "X11", "Xpm", "Xft", "Xext", "python", ["python-dev", "python-dev-2.4"] ]

Note that root will accept either python-dev or python-dev-2.4 with the preference being python-dev.

Clone this wiki locally