PyOGP Client Library Development Sandbox

From Second Life Wiki
Jump to navigation Jump to search

We will first run down the general explanation and add platform specific notes later.

Browse the Code

If all you want to do is glance at the source code, use the browser link to the repository

Prerequisites

You must have the following installed:

  • Subversion 1.4.4 or greater
  • Python 2.4.4, 2.5.x (fails on 2.6 currently and untested on 3.0)

Note: Snow Leopard upgrades require a reinstall of XCode, in this case to accommodate gcc (and greenlet).

Note: Buildout does not yet support subversion 1.6, only 1.4.4-1.5.x.

Environment Preparation

Setuptools and easy_install are Python standard means for installing modules. For more info, start here: http://pypi.python.org/pypi/setuptools.

Virtualenv is a method which allows you to create isolated Python environments, separate from your base install if you so prefer. For more, see here: http://pypi.python.org/pypi/virtualenv.

Your distribution may have Python's setuptools and virtualenv packages in its package repository. If so, it is probably best to use your normal package installation procedures (see below for information on specific Linux distributions). If the packages are not available then follow these generic instructions.

Generic *nix distribution

In order to install Python Packages and creating a development sandbox you have to do the following:

easy_install

Download ez_setup.py and run it with your Python interpreter. You can find it here: http://peak.telecommunity.com/dist/ez_setup.py

Eventually you have to be root to do this depending on your system (mostly non-windows). It should look like this on a unix based machine:

wget http://peak.telecommunity.com/dist/ez_setup.py
sudo python ez_setup.py

virtualenv

One may choose to create an isolated python instance on your host, to be able to work with PyOGP without installing packages to your base Python install on your host.

To use a dedicated python installation in your host, install virtualenv like this:

easy_install virtualenv

Or, if you need to be root something like this:

sudo easy_install virtualenv

On windows, you may need a different path to easy_install

c:\Python25\Scripts\easy_install.exe virtualenv

Install methods

Python modules can be installed in a variety of ways...

Install Method 1: buildout

We use zc.buildout to automatically setup a development environment. buildout gives you the ability to install packages only locally instead of your global python installation. It's sort of a local python installation which helps you avoiding version conflicts of packages.

1. First check out the buildout into a directory of your choice:

svn co http://svn.secondlife.com/svn/linden/projects/2008/pyogp/buildouts/libdev/trunk/ libdev

For those who are interested, tagged and stable version of buildout (with pinned versions on externals) is available at https://svn.secondlife.com/svn/linden/projects/2008/pyogp/buildouts/libdev/tags/0.1/.

2. (Optional) Now turn this directory into a virtual python environment which is independent of your normal Python installation:

cd libdev
virtualenv . --no-site-packages

on windows, you may need to specify the path

c:\Python25\Scripts\virtualenv.exe . --no-site-packages

3. Now run the bootstrap.py file with the newly created local Python interpreter (if installed. If not, use your system's python.):

bin/python bootstrap.py

or on Windows:

 Scripts\python bootstrap.py

4. This creates a bunch of directories and the bin/buildout script (bin\buildout.exe on windows). We now run this:

 bin/buildout -v

or on Windows:

 bin\buildout.exe -v

5. The development sandbox is ready. There now is a bin/pyogp which is a python interpreter which contains all the installed packaged and the pyogp library and related projects.

6. Test the buildout installation. To test this installation you can (at least at this stage of the project) try the following:

 bin/region_connect <firstname> <lastname>

Give your Avatar name and it will ask for a password. Then it tries to login to the Preview Grid.

Install Method 2: setup.py

How to check out packages and using them independently of buildout.

If you are comfortable, feel free to use setup.py (with or without a dedicated virtualenv) in any of the following repos:

Dev: https://svn.secondlife.com/svn/linden/projects/2008/pyogp/pyogp.apps/trunk
Dev: https://svn.secondlife.com/svn/linden/projects/2008/pyogp/pyogp.lib.base/trunk/
Dev: https://svn.secondlife.com/svn/linden/projects/2008/pyogp/pyogp.lib.client/trunk/

Each of the repos already has eggs embedded, and pyogp.apps has the appropriate dependency on pyogp.lib.base configured, which can be checked out and installed in isolation.

1. Check out the repository of your choice

svn co https://svn.secondlife.com/svn/linden/projects/2008/pyogp/<the repo you wanted>/trunk <your pyogp dir>

2. Run setup.py

cd <your pyogp dir>
python setup.py

Run the tests

See PyOGP_Client_Library#Pyogp_Unit_Tests for details...


The structure of the sandbox

You now might wonder what all those directories are good for. To learn more about this check out the Filesystem Structure