Add -V | --version and simplfy changing it

This commit is contained in:
rocky 2016-05-02 04:03:04 -04:00
parent 08720474bf
commit ceb47aba9c
8 changed files with 100 additions and 26 deletions

View File

@ -1,6 +1,50 @@
2016-05-02 rocky <rocky@gnu.org>
* __pkginfo__.py, bin/pydisassemble, bin/uncompyle6, setup.py,
uncompyle6/__init__.py, uncompyle6/version.py: Add -V | --version
and simplfy changing it
2016-05-01 rocky <rocky@gnu.org>
* uncompyle6/__init__.py: Expose uncompyle_file
2016-05-01 rocky <rocky@gnu.org>
* test/Makefile, uncompyle6/semantics/pysource.py: Bug
2016-05-01 rocky <rocky@gnu.org>
* test/Makefile, test/simple_source/expression/05_const_map.py: Add
test for last fix. Drop 2.5 test until we figure out what's wrong
2016-05-01 rocky <rocky@gnu.org>
* uncompyle6/parsers/parse3.py, uncompyle6/scanners/scanner35.py,
uncompyle6/semantics/pysource.py: Bug in 3.5 constant map parsing
2016-05-01 rocky <rocky@gnu.org>
* uncompyle6/__init__.py: Export module load and fns load_file,
load_module
2016-05-01 rocky <rocky@gnu.org>
* __pkginfo__.py, setup.py, uncompyle6/marsh.py: License is MIT marsh.py: remove unused import
2016-05-01 rocky <rocky@gnu.org>
* uncompyle6/parsers/parse3.py: Forgot to define Python3ParserSingle
2016-05-01 rocky <rocky@gnu.org>
* uncompyle6/parser.py, uncompyle6/parsers/parse2.py,
uncompyle6/parsers/parse3.py: Start to DRY Python2 and Python3
grammars Separate out 3.2, and 3.5+ specific grammar code
2016-04-30 rocky <rocky@gnu.org>
* README.rst, __pkginfo__.py: Get ready for release 2.3.0
* ChangeLog, NEWS, README.rst, __pkginfo__.py: Get ready for release
2.3.1
2016-04-30 rocky <rocky@gnu.org>

11
NEWS
View File

@ -1,4 +1,13 @@
uncompyle6 2.2.1 2016-04-30
uncompyle6 2.3.2 2016-05-1
- Add --version option standalone scripts
- Correct License information in package
- expose fns uncompyle_file, load_file, and load_module
- Start to DRY Python2 and Python3 grammars Separate out 3.2, and 3.5+
specific grammar code
- Fix bug in 3.5+ constant map parsing
uncompyle6 2.3.0, 2.3.1 2016-04-30
- Require spark_parser >= 1.1.0

View File

@ -50,7 +50,6 @@ def get_srcdir():
return os.path.realpath(filename)
ns = {}
version = '2.3.1'
web = 'https://github.com/rocky/python-uncompyle6/'
# tracebacks in zip files are funky and not debuggable

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# Mode: -*- python -*-
#
# Copyright (c) 2015 by Rocky Bernstein <rb@dustyfeet.com>
# Copyright (c) 2015-2016 by Rocky Bernstein <rb@dustyfeet.com>
#
from __future__ import print_function
import sys, os, getopt
@ -9,11 +9,13 @@ import sys, os, getopt
program = os.path.basename(__file__)
__doc__ = """
Usage: %s [OPTIONS]... FILE
Usage:
%s [OPTIONS]... FILE
%s [--help | -h | -V | --version]
Examples:
%s foo.pyc
%s foo.py
%s foo.pyc
%s foo.py
%s -o foo.pydis foo.pyc
%s -o /tmp foo.pyc
@ -24,7 +26,7 @@ Options:
<path>
--help show this message
""" % ((program,) * 5)
""" % ((program,) * 6)
Usage_short = \
@ -32,6 +34,7 @@ Usage_short = \
from uncompyle6 import check_python_version
from uncompyle6.disas import disassemble_files
from uncompyle6.version import VERSION
check_python_version(program)
@ -40,7 +43,7 @@ out_base = None
try:
opts, files = getopt.getopt(sys.argv[1:], 'ho:', ['help'])
opts, files = getopt.getopt(sys.argv[1:], 'hVo:', ['help', 'version'])
except getopt.GetoptError as e:
print('%s: %s' % (os.path.basename(sys.argv[0]), e), file=sys.stderr)
sys.exit(-1)
@ -48,6 +51,9 @@ except getopt.GetoptError as e:
for opt, val in opts:
if opt in ('-h', '--help'):
print(__doc__)
sys.exit(1)
elif opt in ('-V', '--version'):
print("%s %s" % (program, VERSION))
sys.exit(0)
elif opt == '-o':
outfile = val

View File

@ -1,16 +1,23 @@
#!/usr/bin/env python
# Mode: -*- python -*-
#
# Copyright (c) 2015-2016 by Rocky Bernstein
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
# Copyright (c) 2015 by Rocky Bernstein
#
from __future__ import print_function
import sys, os, getopt, time
"""
Usage: uncompyle6 [OPTIONS]... [ FILE | DIR]...
program = os.path.basename(__file__)
__doc__ = """
Usage:
%s [OPTIONS]... [ FILE | DIR]...
%s [--help | -h | --V | --version]
Examples:
uncompyle6 foo.pyc bar.pyc # decompile foo.pyc, bar.pyc to stdout
uncompyle6 -o . foo.pyc bar.pyc # decompile to ./foo.pyc_dis and ./bar.pyc_dis
uncompyle6 -o /tmp /usr/lib/python1.5 # decompile whole library
%s foo.pyc bar.pyc # decompile foo.pyc, bar.pyc to stdout
%s -o . foo.pyc bar.pyc # decompile to ./foo.pyc_dis and ./bar.pyc_dis
%s -o /tmp /usr/lib/python1.5 # decompile whole library
Options:
-o <path> output decompiled files to this path:
@ -34,26 +41,25 @@ Options:
Debugging Options:
--asm -a include byte-code (disables --verify)
--grammar -g show matching grammar
--treee -t include syntax tree (disables --verify)
--tree -t include syntax tree (disables --verify)
Extensions of generated files:
'.pyc_dis' '.pyo_dis' successfully decompiled (and verified if --verify)
+ '_unverified' successfully decompile but --verify failed
+ '_failed' decompile failed (contact author for enhancement)
"""
from __future__ import print_function
import sys, os, getopt, time
""" % ((program,) * 6
program = os.path.basename(__file__)
from uncompyle6 import verify, check_python_version
from uncompyle6.main import main, status_msg
from uncompyle6.version import VERSION
def usage():
print("""usage:
%s [--help] [--verify] [--asm] [--tree] [--grammar] [-o <path>] FILE|DIR...
""" % program)
%s [--verify] [--asm] [--tree] [--grammar] [-o <path>] FILE|DIR...
%s [--help | -h | --version | -V]
""" % (program, program))
sys.exit(1)
@ -68,8 +74,8 @@ timestamp = False
timestampfmt = "# %Y.%m.%d %H:%M:%S %Z"
try:
opts, files = getopt.getopt(sys.argv[1:], 'hagtdro:c:p:',
'help asm grammar recurse timestamp tree verify '
opts, files = getopt.getopt(sys.argv[1:], 'hagtdrVo:c:p:',
'help asm grammar recurse timestamp tree verify version '
'showgrammar'.split(' '))
except getopt.GetoptError as e:
print('%s: %s' % (os.path.basename(sys.argv[0]), e), file=sys.stderr)
@ -80,6 +86,9 @@ for opt, val in opts:
if opt in ('-h', '--help'):
print(__doc__)
sys.exit(0)
elif opt in ('-V', '--version'):
print("%s %s" % (program, VERSION))
sys.exit(0)
elif opt == '--verify':
options['do_verify'] = True
elif opt in ('--asm', '-a'):

View File

@ -6,11 +6,13 @@ from __pkginfo__ import \
author, author_email, \
license, long_description, \
modname, packages, py_modules, scripts, \
short_desc, version, web, zip_safe
short_desc, web, zip_safe
__import__('pkg_resources')
from setuptools import setup
exec(open('uncompyle6/version.py').read())
setup(
author = author,
author_email = author_email,
@ -26,5 +28,5 @@ setup(
url = web,
setup_requires = ['nose>=1.0'],
scripts = scripts,
version = version,
version = VERSION,
zip_safe = zip_safe)

View File

@ -30,6 +30,8 @@ from __future__ import print_function
import sys
__docformat__ = 'restructuredtext'
PYTHON3 = (sys.version_info >= (3, 0))
# We do this crazy way to support Python 2.6 which

3
uncompyle6/version.py Normal file
View File

@ -0,0 +1,3 @@
# This file is suitable for sourcing inside bash as
# well as importing into Python
VERSION='2.3.2'