PyOGP Client Library Development Sandbox: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
(45 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{PyOGP/navigation}}
We will first run down the general explanation and add platform specific notes later.
We will first run down the general explanation and add platform specific notes later.


Line 5: Line 6:
== Prerequisites ==
== Prerequisites ==


Agents used in testing need to be in the gridnauts group in sl.
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)
* pyopenssl http://sourceforge.net/projects/pyopenssl/files/pyopenssl-win/0.8a1/pyOpenSSL-0.8a1.winxp32-py2.5.msi/download (Windows 32-bit)


You need to have the following things installed:<br>
'''Note:''' Snow Leopard upgrades require a reinstall of XCode, in this case to accommodate gcc (and greenlet).
<b>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.</b>


<table>
'''Note:''' Buildout does not yet support subversion 1.6, only 1.4.4-1.5.x.
<Tr><Td width=200>Component<td width=300>URL<td width=100>Linux<td width=100>Windows XP<td width=100>MacOS
<TR><td>Subversion 1.4.x<td>http://subversion.tigris.org/ <Td>Recommended<td>Recommended<td>Recommended
<TR><td>Subversion 1.5.x<td>http://subversion.tigris.org/ <Td>Failed<td><td>
<TR><td>Python 2.3<td>http://python.org/download<td>Failed<td>Failed<td>Failed
<TR><td>Python 2.4<td>http://python.org/download<td>Untested<td>Untested<td>Failed
<TR><td>Python 2.5<td>http://python.org/download<td>Recommended<td>Recommended<td>Pre-installed
<TR><td>C/C++ Compiler<td><td>Required<td>Required<td>XCode
<TR><td>[http://pypi.python.org/pypi/greenlet/0.2 greenlet]<td>http://pypi.python.org/pypi/greenlet/0.2<td>Required<td>Required<td>Required
</table>


== Environment Preparation ==


Linden Stations:
'''Setuptools''' and '''easy_install''' are Python standard means for installing modules. For more info, start here: http://pypi.python.org/pypi/setuptools.
By default have python 2.3.5 installed, which is incompatible with pyogp. Use /local/bin/python on station18 when running pyogp.


=== Mac specific requirements ===
'''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.
 
* 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 [http://www.wingware.com WingIDE], such as wx. Do not run virtualenv if you want to use GUIs and WingIDE.
 
=== Windows specific requirements ===
 
=== Linux specific requirements ===
 
== Installing easy_install and 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 Linux distribution ===
=== 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:


1. Download ez_setup.py and run it with your Python interpreter. You can find it here: http://peak.telecommunity.com/dist/ez_setup.py
==== 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:
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:
Line 48: Line 34:
  wget http://peak.telecommunity.com/dist/ez_setup.py
  wget http://peak.telecommunity.com/dist/ez_setup.py
  sudo python ez_setup.py
  sudo python ez_setup.py


2. Install virtualenv like this:
==== 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
  easy_install virtualenv


or if you need to be root something like this:
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
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


=== Gentoo Linux ===
== Install methods ==
 
As root, run:


emerge setuptools
Python modules can be installed in a variety of ways...
emerge virtualenv


== Getting the buildout ==
=== 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.
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.
Line 77: Line 63:
  svn co http://svn.secondlife.com/svn/linden/projects/2008/pyogp/buildouts/libdev/trunk/ libdev
  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:
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/.


svn co http://svn.secondlife.com/svn/linden/projects/2008/pyogp/buildouts/libdev_svn15/trunk/ libdev
2. '''(Optional)''' Now turn this directory into a virtual python environment which is independent of your normal Python installation:
 
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
  cd libdev
Line 92: Line 74:
  c:\Python25\Scripts\virtualenv.exe . --no-site-packages
  c:\Python25\Scripts\virtualenv.exe . --no-site-packages


3. Now run the bootstrap.py file with the newly created local Python interpreter:
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
  bin/python bootstrap.py
Line 110: Line 92:
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.
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 ==
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:


Run the tests by simply saying
: '''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/


bin/client_unittest
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.


Hopefully they all pass.
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>


== Using the login example ==
2. Run setup.py
cd <your pyogp dir>
python setup.py


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


  bin/login <firstname> <lastname>
See [[PyOGP_Client_Library#Pyogp_Unit_Tests]] for details...


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.




Line 132: Line 128:


[[Category: Pyogp_Client_Lib]]
[[Category: Pyogp_Client_Lib]]
[[Category:Pyogp_Kitchen_Sink]]
[[Category:Pyogp Draft]]

Revision as of 15:20, 9 October 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 must have the following installed:

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