Add tests and start a more turnkey testing system.

This commit is contained in:
rocky
2015-12-13 00:25:34 -05:00
parent 832debeb70
commit 3d4e23cc9c
130 changed files with 12657 additions and 201 deletions

View File

@@ -1,32 +1,31 @@
uncompyle2
uncompyle6
==========
A Python 2.5, 2.6, 2.7 byte-code decompiler, written in Python 2.7
A Python 2.x and possibly 3.x byte-code decompiler.
This is written in Python 2.7 but is Python3 compatible.
Introduction
------------
'uncompyle2' converts Python byte-code back into equivalent Python
source code. It accepts byte-code from Python version 2.5 to 2.7.
Additionally, it will only run on Python 2.7.
'uncompyle6' converts Python byte-code back into equivalent Python
source code. It accepts byte-codes from Python version 2.5 to 2.7.
It runs on Python 2.7 and with a little more work Python 3.
The generated source is very readable: docstrings, lists, tuples and
hashes get pretty-printed.
The generated source is fairly readable: docstrings, lists, tuples and
hashes are somewhat pretty-printed.
'uncompyle2' is based on John Aycock's generic small languages compiler
'spark' (http://www.csr.uvic.ca/~aycock/python/) and his prior work on
a tool called 'decompyle'. This tool has been vastly improved by
Hartmut Goebel `http://www.crazy-compilers.com/`_
'uncompyle6' is based on John Aycock's generic small languages
compiler 'spark' (http://www.csr.uvic.ca/~aycock/python/) and his
prior work on a tool called 'decompyle'. This was improved by Hartmut Goebel
`http://www.crazy-compilers.com/`_
# Additional note (3 July 2004, Ben Burton):
# Additional note (3 July 2004):
This software is no longer available from the original website. It has
now become a commercial decompilation service, with no software
available for download.
Any developers seeking to make alterations or enhancements to this code
should therefore consider these debian packages an appropriate starting
point.
This software is no longer available from the original website.
However http://www.crazy-compilers.com/decompyle/ provides a
decompilation service.
# Additional note (5 June 2012):
@@ -34,6 +33,14 @@ The decompilation of python bytecode 2.5 & 2.6 is based on the work of
Eloi Vanderbeken. bytecode is translated to a pseudo 2.7 python bytecode
and then decompiled.
# Additional note (12 Dec 2016):
I will be using this to deparse fragments of code inside my trepan_
debuggers_. For that, I need to record text fragements for all
byte-code offsets (of interest). This purpose although largely
compatible with the original intention is yet a little bit different.
Features
--------
@@ -44,51 +51,53 @@ Features
- output may be written to file, a directory or to stdout
- option for including byte-code disassembly into generated source
For a list of changes please refer to the 'CHANGES' file.
Requirements
------------
uncompyle2 requires Python 2.7
The code runs on Python 2.7. It is compatable with Python3,
and I've run some tests there, but more work is needed to make that
more solid.
Work to support decompyling Python 3 bytecodes and magics is
still needed.
Installation
------------
You may either create a RPM and install this, or install directly from
the source distribution.
This uses setup.py, so it follows the standard Python routine:
Creating RPMS:
python setup.py install # may need sudo
# or if you have pyenv:
python setup.py develop
python setup.py bdist_rpm
A GNU makefile is also provided so `make install` (possibly as root or
sudo) will do the steps above.
### Installation from the source distribution:
Testing
-------
python setup.py install
To install to a user's home-dir:
python setup.py install --home=<dir>
To install to another prefix (eg. /usr/local)
python setup.py install --prefix=/usr/local
For more information on 'Installing Python Modules' please refer to
http://www.python.org/doc/current/inst/inst.html
Testing right now is largely via utility `test/test_pythonlib.py`. A
GNU makefile has been added to smooth over setting running the right
command. If you have remake_ installed, you can see the list of all
tasks including tests via `remake --tasks`
Usage
-----
./scripts/uncompyle2 -h prints usage
Run
./scripts/uncompyle6 -h
for usage help
./test_pythonlib.py test files and python library
Known Bugs/Restrictions
-----------------------
No support for python 3.2
Support Python 3 bytecode and syntax is lacking.
It currently reconstructs most of Python code but probably needs to be tested more thoroughly. All feedback welcome
.. _trepan: https://pypi.python.org/pypi/trepan
.. _debuggers: https://pypi.python.org/pypi/trepan3k
.. _remake: https://bashdb.sf.net/remake