Wednesday 26 March 2008

Reverse Engineering Python Code with PyNSource

PyNSource is a tool that allow us to obtain UML diagrams from python source code.

PyNSource Web Page


INSTALLING PyNSource ON AN UBUNTU GUTSY SYSTEM.

NOTE: You must have python already installed in your system. I assume 2.5 version.

$mkdir PyNSource
$cd PyNSource


Now we download the program and install it:
$wget http://www.atug.com/downloads/pynsource1.4c.zip
$unzip pynsource1.4c.zip
$sudo python setup.py install


We want to run the GUI so we need a graphical library:
$sudo aptitude install python2.5-wxgtk2.6

Current code does not work with version wxgtk2.6 so we need to update it:
$wget http://www.atug.com/andypatterns/code/pyNsourceGui1.4c-wx26.zip
$unzip pyNsourceGui1.4c-wx26.zip
$sudo cp pyNsourceGui-wx26.py /usr/lib/python2.5/site-packages/pynsource/


Finally we exec the GUI module
$python /usr/lib/python2.5/site-packages/pynsource/pyNsourceGui-wx26.py


This application presents some annoying bugs:

* There are problems when moving shapes on the screen. It does not refresh correctly.
* It is difficult to adjust page size when you try to print it.
* When you press right click button on the mouse to delete an object, usually it doesn't delete all the arrows that point to it, messing the schema.
* Saving and opening diagram feature is not implemented yet, so you cannot save temporary work.


Well, you know, this bugs are annoying, but it you dont like them, it is free software, so hack the code. :-)

0 comentarios: