Difference between revisions of "PyOGP Client Library Development Sandbox"
Enus Linden (talk | contribs) |
Enus Linden (talk | contribs) |
||
Line 11: | Line 11: | ||
== Environment Preparation == | == 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. | 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 | === Generic *nix distribution === | ||
In order to install Python Packages and creating a development sandbox you have to do the following: | In order to install Python Packages and creating a development sandbox you have to do the following: | ||
Line 28: | Line 32: | ||
==== virtualenv ==== | ==== 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 | 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: | To use a dedicated python installation in your host, install virtualenv like this: | ||
Line 34: | Line 38: | ||
easy_install virtualenv | easy_install virtualenv | ||
Or, if you need to be root something like this: | |||
sudo easy_install virtualenv | sudo easy_install virtualenv | ||
On windows, you may need a different path to easy_install | |||
c:\Python25\Scripts\easy_install.exe virtualenv | c:\Python25\Scripts\easy_install.exe virtualenv | ||
== Getting the buildout == | == Getting the buildout == |
Revision as of 21:50, 24 August 2009
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 need to have the following things installed:
~ Subversion 1.4.4 or greater ~ Python 2.4.4 or greater (untested on 3.0)
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
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
See https://wiki.secondlife.com/wiki/PyOGP#Project_Status, and for now, do:
svn co -r2596 http://svn.secondlife.com/svn/linden/projects/2008/pyogp/buildouts/libdev/trunk/ libdev
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
See PyOGP_Client_Library#Pyogp_Unit_Tests for details...
Using the login example
To test this installation you can (at least at this stage of the project) try the following:
python apps/region_connect.py <firstname> <lastname>
Give your Avatar name and it will ask for a password. Then it tries to login to the Preview Grid.
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