Skip to content

daifu/g-simulator

Repository files navigation

=======================
Installation
=======================

* For one-time user or developers for staging environment, 
we suggests you should use the following commands at 
root of project directory:

To install, this command would create symlink to project directory
for python to know
> sudo python setup.py develop 

To uninstall i.e. remove the symlink
> sudo python setup.py develop --uninstall

* For pernament user, this is experimental. Do not try this
out unless you understand python setuptools.

To install, this would build and install the package into 
/usr/local/lib/python2.X/dist-packages/ (assuming -nix platform)
> sudo python setup.py install

To uninstall, python setuptools is pretty bad at this. You need
to remove the directory pygnutella-X.X-py2.X.egg from
/usr/local/lib/python2.X/dist-packages/ manually.

* After you install successfully by one of two ways above, now you can
try our example code of our framework. Look to next section Demo for
that

=======================
Demo
=======================

Inside "examples" directory, each python script is a separate example.
If the example is large, it puts into a directory of its own include
with is own README for running it.

Each example is designed to demo a part of framework i.e. showing
how to use the framework. Once you successfully installed
the package, you can run the example with ease in a terminal.

For example, you can run simple_cache_example.py:
> cd examples
> python simple_cache_example.py

To further you understanding of pygnutella framework, please
look at next section Framework Design.

=======================
Framework Design
=======================

Please look into report.pdf that comes with this.

=======================
Coding Standard
=======================

+ indentation is 4 spaces not 2 spaces (and also not a tab). Configure your
editor to do so.
+ your class is in directory pygnutella (aka package pygnutella)
+ test script is in directory tests
+ class name: class name capitalise every word
+ method name and variable name: lower case and underscore between every word
+ use one logger from Servent
     
+ use doc string three quote """ """ for every class or function you feel the
name is too ambiguous
+ use # for comment

=======================
How to make and run unit test
=======================

1. Install nose using setuptools/distribute:

> easy_install nose
OR
> pip install nose

Or, if you don’t have setuptools/distribute installed, cd to the source
package(nose-1.1.2), and:

> python setup.py install
OR
> sudo python setup.py install

2. Run the test:
Go to the main directory, which is under g-simulator/
> nosetests

3. Naming convention for test files: please make sure all the file names are
[class_name]_tests.py, or the test will fail.

4. Import libraries for testing
for example, we want to test message.py file:
> from nose.tools import *
> from pygnutella.message import Message

About

A G Network Simulator.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages