You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Merge branch 'python-3.0-to-3.2' into python-2.4
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
# Mode: -*- python -*-
|
||||
#
|
||||
# Copyright (c) 2015-2017, 2019-2020, 2023 by Rocky Bernstein
|
||||
# Copyright (c) 2015-2017, 2019-2020, 2023-2024
|
||||
# by Rocky Bernstein
|
||||
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||
#
|
||||
|
||||
import getopt
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
@@ -16,6 +16,12 @@ from uncompyle6.version import __version__
|
||||
|
||||
program = "uncompyle6"
|
||||
|
||||
|
||||
def usage():
|
||||
print(__doc__)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
__doc__ = """
|
||||
Usage:
|
||||
%s [OPTIONS]... [ FILE | DIR]...
|
||||
@@ -68,44 +74,18 @@ Extensions of generated files:
|
||||
(program,) * 5
|
||||
)
|
||||
|
||||
program = "uncompyle6"
|
||||
|
||||
def usage():
|
||||
print(__doc__)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main_bin():
|
||||
if not (
|
||||
sys.version_info[0:2]
|
||||
in (
|
||||
(2, 4),
|
||||
(2, 5),
|
||||
(2, 6),
|
||||
(2, 7),
|
||||
(3, 0),
|
||||
(3, 1),
|
||||
(3, 2),
|
||||
(3, 3),
|
||||
(3, 4),
|
||||
(3, 5),
|
||||
(3, 6),
|
||||
(3, 7),
|
||||
(3, 8),
|
||||
(3, 9),
|
||||
(3, 10),
|
||||
(3, 11),
|
||||
)
|
||||
):
|
||||
print('Error: %s requires Python 2.4-3.10' % program)
|
||||
sys.exit(-1)
|
||||
recurse_dirs = False
|
||||
|
||||
numproc = 0
|
||||
outfile = "-"
|
||||
out_base = None
|
||||
|
||||
out_base = None
|
||||
source_paths = []
|
||||
timestamp = False
|
||||
timestampfmt = "# %Y.%m.%d %H:%M:%S %Z"
|
||||
pyc_paths = files
|
||||
|
||||
try:
|
||||
opts, pyc_paths = getopt.getopt(
|
||||
@@ -182,7 +162,7 @@ def main_bin():
|
||||
sys.stderr.write(opt)
|
||||
usage()
|
||||
|
||||
# expand directory if specified
|
||||
# Expand directory if "recurse" was specified.
|
||||
if recurse_dirs:
|
||||
expanded_files = []
|
||||
for f in pyc_paths:
|
||||
@@ -216,15 +196,32 @@ def main_bin():
|
||||
out_base = outfile
|
||||
outfile = None
|
||||
|
||||
# A second -a turns show_asm="after" into show_asm="before"
|
||||
if asm_plus or asm:
|
||||
asm_opt = "both" if asm_plus else "after"
|
||||
else:
|
||||
asm_opt = None
|
||||
|
||||
if timestamp:
|
||||
print(time.strftime(timestampfmt))
|
||||
|
||||
if numproc <= 1:
|
||||
show_ast = {"before": tree or tree_plus, "after": tree_plus}
|
||||
try:
|
||||
result = main(
|
||||
src_base, out_base, pyc_paths, source_paths, outfile, **options
|
||||
src_base,
|
||||
out_base,
|
||||
pyc_paths,
|
||||
source_paths,
|
||||
outfile,
|
||||
showasm=asm_opt,
|
||||
showgrammar=show_grammar,
|
||||
showast=show_ast,
|
||||
do_verify=verify,
|
||||
do_linemaps=linemaps,
|
||||
start_offset=start_offset,
|
||||
stop_offset=stop_offset,
|
||||
)
|
||||
result = [options.get("do_verify", None)] + list(result)
|
||||
if len(pyc_paths) > 1:
|
||||
mess = status_msg(*result)
|
||||
print("# " + mess)
|
||||
|
Reference in New Issue
Block a user