You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
Add --max option on pyenv ...
and extend list of pyenv versions
This commit is contained in:
@@ -27,13 +27,15 @@ from fnmatch import fnmatch
|
||||
|
||||
#----- configure this for your needs
|
||||
|
||||
TEST_VERSIONS=('2.3.7', '2.4.6', '2.5.6', '2.6.9',
|
||||
TEST_VERSIONS=(
|
||||
'pypy-2.4.0', 'pypy-2.6.1',
|
||||
'pypy-5.0.1', 'pypy-5.3.1', 'pypy3.5-5.7.1-beta',
|
||||
# FIXME: get this from xdis magics.
|
||||
'2.3.7', '2.4.6', '2.5.6', '2.6.9',
|
||||
'2.7.10', '2.7.11', '2.7.12', '2.7.13', '2.7.14',
|
||||
'3.0.1', '3.1.5', '3.2.6',
|
||||
'3.3.5', '3.3.6',
|
||||
'3.4.2', '3.5.3', '3.6.0', '3.6.3',
|
||||
'3.3.5', '3.3.6', '3.3.7',
|
||||
'3.4.2', '3.5.3', '3.6.0', '3.6.3', '3.6.4',
|
||||
'native')
|
||||
|
||||
target_base = '/tmp/py-dis/'
|
||||
@@ -65,7 +67,8 @@ for vers in TEST_VERSIONS:
|
||||
test_options[vers] = (os.path.join(lib_prefix, vers, 'lib', 'python'+short_vers),
|
||||
PYC, 'python-lib'+short_vers)
|
||||
|
||||
def do_tests(src_dir, patterns, target_dir, start_with=None, do_verify=False):
|
||||
def do_tests(src_dir, patterns, target_dir, start_with=None,
|
||||
do_verify=False, max_files=200):
|
||||
|
||||
def visitor(files, dirname, names):
|
||||
files.extend(
|
||||
@@ -99,14 +102,14 @@ def do_tests(src_dir, patterns, target_dir, start_with=None, do_verify=False):
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if len(files) > 200:
|
||||
if len(files) > max_files:
|
||||
files = [file for file in files if not 'site-packages' in file]
|
||||
files = [file for file in files if not 'test' in file]
|
||||
if len(files) > 200:
|
||||
if len(files) > max_files:
|
||||
# print("Numer of files %d - truncating to last 200" % len(files))
|
||||
# files = files[-200:]
|
||||
print("Numer of files %d - truncating to first 200" % len(files))
|
||||
files = files[:200]
|
||||
print("Numer of files %d - truncating to first %s" %
|
||||
(len(files), max_files))
|
||||
files = files[:max_files]
|
||||
|
||||
print(time.ctime())
|
||||
main.main(src_dir, target_dir, files, [], do_verify=do_verify)
|
||||
@@ -123,9 +126,10 @@ if __name__ == '__main__':
|
||||
test_options_keys.sort()
|
||||
opts, args = getopt.getopt(sys.argv[1:], '',
|
||||
['start-with=', 'verify', 'weak-verify',
|
||||
'coverage', 'all', ] \
|
||||
'max=', 'coverage', 'all', ] \
|
||||
+ test_options_keys )
|
||||
vers = ''
|
||||
|
||||
for opt, val in opts:
|
||||
if opt == '--verify':
|
||||
do_verify = True
|
||||
@@ -139,6 +143,8 @@ if __name__ == '__main__':
|
||||
triple = test_options[opt[2:]]
|
||||
vers = triple[-1]
|
||||
test_dirs.append(triple)
|
||||
elif opt == '--max':
|
||||
test_options['max'] = int(val)
|
||||
elif opt == '--all':
|
||||
vers = 'all'
|
||||
for val in test_options_keys:
|
||||
@@ -154,7 +160,8 @@ if __name__ == '__main__':
|
||||
target_dir = os.path.join(target_base, target_dir)
|
||||
if os.path.exists(target_dir):
|
||||
shutil.rmtree(target_dir, ignore_errors=1)
|
||||
do_tests(src_dir, pattern, target_dir, start_with, do_verify)
|
||||
do_tests(src_dir, pattern, target_dir, start_with,
|
||||
do_verify, test_options['max'])
|
||||
else:
|
||||
print("### Path %s doesn't exist; skipping" % src_dir)
|
||||
|
||||
|
@@ -66,7 +66,7 @@ test_options = {
|
||||
PYOC, 'ok-2.7', 2.7),
|
||||
|
||||
'ok-3.2': (os.path.join(src_dir, 'ok_lib3.2'),
|
||||
PYOC, 'ok-3.2', 3.5),
|
||||
PYOC, 'ok-3.2', 3.2),
|
||||
|
||||
'base-2.7': (os.path.join(src_dir, 'base_tests', 'python2.7'),
|
||||
PYOC, 'base_2.7', 2.7),
|
||||
|
Reference in New Issue
Block a user