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

Agents used in testing need to be in the gridnauts group in sl.

You need to have the following things installed:
Note: subversion 1.5.x was tried, and it gave errors such as "unrecognized .svn/entries format" and "log not found". We suggest using svn 1.4.x. Also, if you use TortoiseSVN, use the 1.4.x version as well. Finally, it seems that these steps need to be done in order, but that is not fully confirmed.

ComponentURLLinuxWindows XPMacOS
Subversion 1.4.xhttp://subversion.tigris.org/ RecommendedRecommendedRecommended
Subversion 1.5.xhttp://subversion.tigris.org/ Failed
Subversion 1.5.4http://subversion.tigris.org/ Gentoo co OK
Python 2.3http://python.org/downloadFailedFailedFailed
Python 2.4http://python.org/downloadUntestedUntestedFailed
Python 2.5http://python.org/downloadRecommendedRecommendedPre-installed
C/C++ CompilerRequiredRequiredXCode
setuptools 0.6c9http://peak.telecommunity.com/Rqd by greenlet
greenlethttp://pypi.python.org/pypi/greenlet/0.2RequiredRequiredRequired

Mac specific requirements

  • make sure you have X-Code installed.
  • zc.Buildout on the mac requires python 2.5. This is the pre-installed version.
  • Use the pre-installed version of python to use some of the GUI packages with the WingIDE, such as wx. Do not run virtualenv if you want to use GUIs and WingIDE.

Windows specific requirements

Linux specific requirements

Environment Preparation

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 Linux 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

greenlet

Install greenlet (required by eventlet for running coroutines)

 sudo easy_install greenlet

There may be a requirement to update your setuptools. If so, do this:

 sudo easy_install -U setuptools

virtualenv

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

Gentoo Linux

As root, run:

emerge setuptools
emerge virtualenv


Note that there is now a dependency on greenlet, which is not available in Portage. Instead use:

 easy_install greenlet

In addition, greenlet itself adds a dependency on the non-stable setuptools-0.6c9 , so either add:

/etc/portage/package.keywords:  dev-python/setuptools ~x86

or use

ACCEPT_KEYWORDS='~x86' emerge setuptools

Getting the 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

If you are using svn1.5 or have otherwise problems on Mac OSX, try this buildout instead:

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

It needs Python2.5 though (which is the standard Python version of Mac OSX though)

2. Now turn this directory into a virtual python environment which is independant 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:

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.

Run the tests

Run the tests by simply saying

bin/client_unittest

Hopefully they all pass.

Using the login example

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

 bin/login <firstname> <lastname>

Give your Avatar name and it will ask for a password. Then it tries to login using the Linden Lab Agent Domain and placing the avatar on a different's grid region. You need to be in the gridnauts group though.


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