====================================================
How to run your own private PyPI (Cheeseshop) server
====================================================

Why ?
-----

You have some python packages you want to treat the same way 
the Cheeseshop does. In other words you want to work with them
with easy_install, zc.buildout, etc..

But these packages are private to your company...

The simplest way is to store your eggs on some network folder.
But distutils and setuptools provide a nice set of commands
to automatically build and upload eggs at PyPI or any server 
that implements PyPI apis.

How ? PloneSoftwareCenter !
---------------------------

The Plone community provides a nice tool to manage Python packages, 
and it is PyPI compatible. In other words it can act like Cheesehop
to interact with your command line tools.

It also provides an extensive set of features to manage your releases,
run your bug trackers, etc.

Screenshots

4 steps to install
------------------

Thanks to zc.buildout, a Plone Software Center (PSC) is really easy to setup.
There's no binary distribution yet though, so you need to compile a few things.

Step 1 - Pre-requests
=====================

If you are under windows, grab this archive : http://release.ingeniweb.com/third-party-dist/python2.4.4-win32.zip
decompress it, and run "install.bat". It will install Python 2.4 together with a set of tools, and PATH
updates.

If you are under Linux, make sure you have gcc, subversion and make installed. Then install easy_install and PIL,
like this::

    $ wget http://peak.telecommunity.com/dist/ez_setup.py
    $ python ez_setup.py
    $ easy_install http://release.ingeniweb.com/third-party-dist/PILwoTk-1.1.6.4.tar.gz

Step 2 - installing PSC
=======================

1. Make a directory on your system called softwarecenter
2. get into it and run in the command line::

    $ svn co http://svn.plone.org/svn/collective/Products.PloneSoftwareCenter/buildout/trunk .

3. run the buildout with this set of commands::

    $ python boostrap.py
    $ bin/buildout

  It will take some time, to grab all elements needed to build PSC.

4. run the server

    $ bin/instance start


Step 3 - setting up PSC
=======================

Let's create a Plone website with a PloneSoftwareCenter

1. Open a browser and go to http://localhost:8080/manage. The login/password is admin/admin.
2. On the left part, there's a dropbox, select "Plone Site" the hit the add button
3. In the form, set the id to "plone" and hit enter.
4. Go to  http://localhost:8080/plone/prefs_install_products_form
5. Check "PloneSoftwareCenter" on the left side and hit "Install"
6. Go to http://localhost:8080/plone
7. In the "Add new..." menu, Click on "software center"
8. In the form, in the Title, put "Catalog"
9. Check "Use Classifiers to display Categories (with Topic :: *)" under Classifiers
10. Hit the Save button

Your Software Center is ready and available at http://localhost:8080/plone/catalog


Step 4 - setting up the client-side
===================================

Now let's set the client-side so people can use your Software Center:

1. install iw.dist::
    
     $ easy_install iw.dist

2. create a file in your home directory, called `.pypirc` with this content::

     
    [distutils]

    index-servers = 
        pypi
        local

    [pypi]
    username:YOUR_PYPI_LOGIN
    password:YOUR_PYPI_PASSWORD

    [local] 
    repository:http://localhost:8080/plone/catalog/
    username:admin
    password:admin

Of course, the `localhost` value will differ if you are located on another machine..


Let's use it !
--------------

Now, you will have two new commands in distutils, called 'mregister' and 'mupload'
that will let you use either cheeseshop either Pypi.

Let's upload an egg into PSC::

    $ python setup.py mregister sdist bdist_egg mupload -r local

Let's upload an egg into PyPI::

    $ python setup.py mregister sdist bdist_egg mupload -r pypi

if -r is omited, pypi is the default one.

If you want to use PSC in zc.buildout or easy_install, you can 
provide http://localhost:8080/plone/catalog/simple as a find-links or index
value::

    [buildout]
    
    find-links = http://localhost:8080/plone/catalog/simple

Or::

    $ easy_install -f http://localhost:8080/plone/catalog/simple my.egg
 



