.. image:: https://travis-ci.org/enthought/enstaller.png
  :target: https://travis-ci.org/enthought/enstaller

.. image:: https://coveralls.io/repos/enthought/enstaller/badge.png
  :target: https://coveralls.io/r/enthought/enstaller


The Enstaller (version 4) project is a package management and installation
tool for egg-based Python distributions.

Enstaller consists of the sub-packages enstaller (package management
tool) and egginst (package (un)installation tool).  We find the clean
separation into these two tasks, each of which has a well-defined
scope, extremely useful.


enstaller:
----------

enstaller is a management tool for egginst-based installs. The CLI,
called enpkg, calls out to egginst to do the actual installation.
enpkg can access distributions from local and HTTP repositories, which
are pre-indexed.  The point of the index file (index-depend.bz2) is that
enpkg can download this file at the beginning of an install session
and resolve dependencies prior to downloading the actual files.


egginst:
--------

egginst is the underlying tool for installing and uninstalling eggs.
The tool is brain dead in the sense that it does not care if the eggs
it installs are for the correct platform, it's dependencies got installed,
another package needs to be uninstalled prior to the install, and so on.
Those tasks are responsibilities of a package manager, and are outside
the scope of egginst.

egginst installs modules and packages directly into site-packages, i.e.
no .egg directories are created; hence, there is no extra .pth file which
results in a shorter python path and faster import times (which seems to
make the biggest difference for namespace packages).  egginst knows about
the eggs the people from Enthought use.  It can install shared libraries,
change binary headers, etc.---things which would require special post-install
scripts if easy_install installed them.


The egg format:
---------------

The Enstaller egg format deals with two aspects: the actual install (egginst),
and distribution management (enpkg).  As far as egginst is concerned,
the format is an extension of the setuptools egg format, i.e. all archive
files, except the ones starting with 'EGG-INFO/' are installed into the
site-packages directory.  In fact, since egginst is a brain dead low-level tool,
it will even install an egg without an 'EGG-INFO' directory.  But more
importantly, egginst installs ordinary setuptools eggs just fine.  Within the
'EGG-INFO/' namespace are special archives that egginst is looking for to
install files, as well as symbolic links into locations other than
site-packages, and post-install (and pre-uninstall) scripts it can run.

As far as enpkg is concerned, eggs should contain a metadata file with the
archive name 'EGG-INFO/spec/depend'.  The index file (index-depend.bz2)
is essentially a compressed concatenation of the 'EGG-INFO/spec/depend' files
for all eggs in a directory/repository.


Egg file name format:
---------------------

Eggs follow the following naming convention::

   <name>-<version>-<build>.egg

``<name>``
   The package name, which may contain the following characters:
   Letters (both lower or uppercase), digits, underscore '_' and a dot '.'

``<version>``
   The version number, which is restricted to containing the
   same characters as the package name, and which should
   follow `PEP 386 <http://www.python.org/dev/peps/pep-0386/>`_.

``<build>``
   The build number, which may only contains digits (with no leading zeros).
   This number is used to distinguish between different eggs which were build
   from the same project source.  Having different build numbers becomes
   necessary when, for example: eggs are build for different Python versions,
   a build bug is fixed, a patch is applied to the source, etc.

The regular expression for a valid egg file name is::

   r'([\w.]+)-([\w.]+)-(\d+)\.egg$'


The metadata format:
--------------------

Build numbers are a way to differentiate eggs which have the
same name and version but different dependencies.  The platform and
architecture dependencies of a distribution (or egg) is most easily
differentiated by putting them into different directories.  This leaves
us with the Python dependency and other egg dependencies to put into the
build number.  A dependencies specification data file is contained inside
the egg itself, that is in the archive ``EGG-INFO/spec/depend``, and the
md5sum and filesize is prepended to the data when the index-depend.bz2 is
created.


Installation:
-------------

The preferred and easiest way to install Enstaller is from the executable egg,
i.e. the Enstaller egg contains a bash header and on Unix systems you can
download the egg and type::

   $ bash enstaller-4.6.1-1.egg
   Bootstrapping: ...
   283 KB [.................................................................]

Once Enstaller is installed, it can update itself.  Note that,
as Enstaller is the install tool for the Enthought Python Distribution (EPD),
all EPD installers already include Enstaller.
