User:Poppy Linden/PyOGP \ libdev Initial Setup Experience
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
sequential, oldest first.
bootstrapping
- omg tons of docs
- omg repeats internally / externally... lemme fix that...
- code?
- ok, what deps are required? wait.. how does python pathing work? oh, i can just put it in my python_path, cool
- wait, this says i need to install a friggin million things.
- I Hate Everything Python Right Now.
- I bootstrapped a wicked python env in my homedir.
mkdir -p ~/local/lib/python2.4/site-packages vi ~/.bashrc >> export PYTHONPATH=$PYTHONPATH:~/local/lib/python2.4/site-packages >> export PATH=$PATH:/usr/local/bin:~/bin:~/local/bin . ~/.bashrc curl -L 'http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c9-py2.4.egg#md5=260a2be2e5388d66bdaee06abec6342a' > setuptools-0.6c9-py2.4.egg sh setuptools-0.6c9-py2.4.egg --prefix=~/local easy_install --prefix=~/local pip easy_install --prefix=~/local virtualenv
- ok, now what again? Oh yeah, virtualenv for pyogp... the point of this...
- virtualenv . --no-site-packages
- bin/python bootstrap.py
- bin/buildout -v
- oh, so virtualenv is preventing the very borknorking i am trying to prevent to my system. Fair game.
bootstrap / sanity verification
- bin/client_unittest
- FAILBOAT
- pip -E . install greenlet
- bin/client_unittest
- now a bunch of crazy shit instead of tracebacks, that's... good?
- 114 tests and 0 failures! that's good!
initial investigations
- vi src/pyogp.lib.base/pyogp/lib/base/tests/base.py
- everything starts with login, even with base. What about the delicious primitives i crave?
- ls -l is your friend. There are subfolders in src/pyogp.lib.base/pyogp/lib/base/, namely one named network, and one named message.
- reading tests is like looking at a tautology; they have no docs. "Yes, i bet that does in fact work that way." What do I see to bootstrap an app?
- i say: "(i want to know what code to see to understand) how to init main, send a message, quit" enus: "well, region.py uses UDPDispatcher. i've not tried using it w/o the entire context" "maybe test_udpconnection.py is a useful reference. it instantiates UDPDispatcher, against a mock host, and sends a message"
- enus: "the Message usage is changing soon. look at the Message() class." "packets.py transforms representations of packet data into Message instqances, but packets.py is going away soon"
- there *really* needs to be a step-by-step to get bootstrapped, I hope this helps write that! I'm still not writing "Hello World" with pyogp yet!
- test app, try 1
- mkdir test_dataserver; cd test_dataserver
- virtualenv . --no-site-packages
- RTFM: pip help install | less
- pip install -E . -e ../libdev/ libdev ... FAIL
- pip install -E . -e svn+../libdev/ libdev ... FAIL
- pip install -E . -e svn+http://svn.secondlife.com/svn/linden/projects/2008/pyogp/buildouts/libdev/trunk libdev ... FAIL
- OH WAIT the problem isn't the dir, it's the "libdev" afterwards
- pip install -E . -e svn+http://svn.secondlife.com/svn/linden/projects/2008/pyogp/buildouts/libdev/trunk ... FAIL but a new error, no setup.py... wait a sec...
- pip install -E . -e svn+http://svn.secondlife.com/svn/linden/projects/2008/pyogp/pyogp.lib.base/trunk/ ... WIN
- should work to just copy a unit test into my src/ dir, copying test_udpconnection.py as it sounds like a good start
- pip install -E . greenlet
- bin/python src/test_udpconnection.py ... aaaaaand... no output. Is that a good thing for a test?
- need some of this:
<python> if __name__ == "__main__":
unittest.main()
</python>
- tests pass. Rad! Let's send some garbage.
learn to send messages
- pyogp.lib.base/pyogp/lib/base/message/circuit.py - the Host class looks a little thin; doesn't take a FQDN, just an IP addy?
- resetting the host in test_find_circuit in my modified copy of test_udpconnection.py doesn't seem to be hitting the desired host / port
- try to reverse-engineer class diagram using pylint and graphviz... hmm...
- finally get *something* - a couple circuits established with the UDPConnectionTest replacing the mock server with my code
- it's making me crazy that MockupTestServer and Client don't seem to map to a real object. It appears to be impossible to trivially modify test_udpconnection.py to connect to a real server instead of a mock.
- so after some tinkering, this works:
p = packet_types.AvatarPropertiesRequestPacket() poppy = UUID() print dir(poppy) print poppy.uuid.bytes p.AgentData['AgentID'] = poppy p.AgentData['SessionID'] = UUID() p.AgentData['AvatarID'] = poppy self.send_message(p, True)
- need a coroutine to sit and wait for response, not that far yet
- much of this functionality is in region.py, should definitely be brought out and into the message package somehow
- chat with enus about branching, possibly mercurial?
- full test, with reliable acks:
<python>
def test_asdf(self): # build message, send it packet = packet_types.AvatarPropertiesRequestPacket() poppy = UUID() packet.AgentData['AgentID'] = poppy packet.AgentData['SessionID'] = UUID() packet.AgentData['AvatarID'] = poppy #self.messenger.send_message(packet, self.host) self.messenger.send_reliable(packet, self.host, 0) # wait for Ack, socket timeout after 1s wait (1000ms) self.messenger.socket.settimeout(1.0) msg_buf, msg_size = self.messenger.udp_client.receive_packet(self.messenger.socket) recv = self.messenger.receive_check(self.messenger.udp_client.get_sender(), msg_buf, msg_size) if recv is None or recv.name != 'PacketAck': self.fail("no data waiting after 1s")
</python>
random hacking
- can't seem to introspect then send all the packet types from dir() on pyogp.lib.base.message.packets
- that's gone, but no obvious way to get message from template...
- eventlet 0.8.12 cheeseshop install seems borked, using 'pip install -E . -f http://pypi.python.org/packages/source/e/eventlet/eventlet-0.8.11.tar.gz eventlet-0.8.11'
- install nose: easy_install --prefix=~/local nose
- bin/python `which nosetests` src/*
- yeah, i want to keep a mercurial fork: hg convert http://svn.secondlife.com/svn/linden/projects/2008/pyogp/pyogp.lib.base/trunk