[pypy-commit] pypy kill-someobject: remove a reference to a removed var and general cleanup
alex_gaynor
noreply at buildbot.pypy.org
Mon Oct 8 11:20:00 CEST 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: kill-someobject
Changeset: r57886:269cdc5bd620
Date: 2012-10-08 11:19 +0200
http://bitbucket.org/pypy/pypy/changeset/269cdc5bd620/
Log: remove a reference to a removed var and general cleanup
diff --git a/pypy/translator/goal/translate.py b/pypy/translator/goal/translate.py
--- a/pypy/translator/goal/translate.py
+++ b/pypy/translator/goal/translate.py
@@ -4,9 +4,11 @@
See below
"""
-import sys, os, new
-import autopath
+import os
+import sys
+
+import autopath
import py
# clean up early pypy/_cache
try:
@@ -14,25 +16,24 @@
except Exception:
pass
-from pypy.config.config import to_optparse, OptionDescription, BoolOption, \
- ArbitraryOption, StrOption, IntOption, Config, \
- ChoiceOption, OptHelpFormatter
-from pypy.config.translationoption import get_combined_translation_config
-from pypy.config.translationoption import set_opt_level, final_check_config
-from pypy.config.translationoption import OPT_LEVELS, DEFAULT_OPT_LEVEL
-from pypy.config.translationoption import PLATFORMS, set_platform
+from pypy.config.config import (to_optparse, OptionDescription, BoolOption,
+ ArbitraryOption, StrOption, IntOption, Config, ChoiceOption, OptHelpFormatter)
+from pypy.config.translationoption import (get_combined_translation_config,
+ set_opt_level, final_check_config, OPT_LEVELS, DEFAULT_OPT_LEVEL, set_platform)
-GOALS= [
- ("annotate", "do type inference", "-a --annotate", ""),
- ("rtype", "do rtyping", "-t --rtype", ""),
- ("pyjitpl", "JIT generation step", "--pyjitpl", ""),
- ("jittest", "JIT test with llgraph backend", "--jittest", ""),
- ("backendopt", "do backend optimizations", "--backendopt", ""),
- ("source", "create source", "-s --source", ""),
- ("compile", "compile", "-c --compile", " (default goal)"),
- ("llinterpret", "interpret the rtyped flow graphs", "--llinterpret", ""),
- ]
+GOALS = [
+ ("annotate", "do type inference", "-a --annotate", ""),
+ ("rtype", "do rtyping", "-t --rtype", ""),
+ ("pyjitpl", "JIT generation step", "--pyjitpl", ""),
+ ("jittest", "JIT test with llgraph backend", "--jittest", ""),
+ ("backendopt", "do backend optimizations", "--backendopt", ""),
+ ("source", "create source", "-s --source", ""),
+ ("compile", "compile", "-c --compile", " (default goal)"),
+ ("llinterpret", "interpret the rtyped flow graphs", "--llinterpret", ""),
+]
+
+
def goal_options():
result = []
for name, doc, cmdline, extra in GOALS:
@@ -40,12 +41,12 @@
if name.startswith('?'):
optional = True
name = name[1:]
- yesdoc = doc[0].upper()+doc[1:]+extra
+ yesdoc = doc[0].upper() + doc[1:] + extra
result.append(BoolOption(name, yesdoc, default=False, cmdline=cmdline,
negation=False))
if not optional:
- result.append(BoolOption("no_%s" % name, "Don't "+doc, default=False,
- cmdline="--no-"+name, negation=False))
+ result.append(BoolOption("no_%s" % name, "Don't " + doc, default=False,
+ cmdline="--no-" + name, negation=False))
return result
translate_optiondescr = OptionDescription("translate", "XXX", [
@@ -79,8 +80,8 @@
ArbitraryOption("skipped_goals", "XXX",
defaultfactory=list),
OptionDescription("goal_options",
- "Goals that should be reached during translation",
- goal_options()),
+ "Goals that should be reached during translation",
+ goal_options()),
])
import optparse
@@ -109,8 +110,7 @@
opt_parser.disable_interspersed_args()
- config = get_combined_translation_config(
- overrides=OVERRIDES, translating=True)
+ config = get_combined_translation_config(translating=True)
to_optparse(config, parser=opt_parser, useoptions=['translation.*'])
translateconfig = Config(translate_optiondescr)
to_optparse(translateconfig, parser=opt_parser)
@@ -125,17 +125,17 @@
if getattr(translateconfig.goal_options, name):
if name not in translateconfig.goals:
translateconfig.goals.append(name)
- if getattr(translateconfig.goal_options, 'no_'+name):
+ if getattr(translateconfig.goal_options, 'no_' + name):
if name not in translateconfig.skipped_goals:
if not reset:
translateconfig.skipped_goals[:] = []
reset = True
translateconfig.skipped_goals.append(name)
-
+
if args:
arg = args[0]
args = args[1:]
- if os.path.isfile(arg+'.py'):
+ if os.path.isfile(arg + '.py'):
assert not os.path.isfile(arg), (
"ambiguous file naming, please rename %s" % arg)
translateconfig.targetspec = arg
@@ -182,7 +182,7 @@
print "\n\nFor detailed descriptions of the command line options see"
print "http://pypy.readthedocs.org/en/latest/config/commandline.html"
sys.exit(0)
-
+
return targetspec_dic, translateconfig, config, args
def log_options(options, header="options in effect"):
@@ -192,8 +192,8 @@
optnames.sort()
for name in optnames:
optvalue = getattr(options, name)
- log('%25s: %s' %(name, optvalue))
-
+ log('%25s: %s' % (name, optvalue))
+
def log_config(config, header="config used"):
log('%s:' % header)
log(str(config))
@@ -225,7 +225,7 @@
prof.disable()
statfilename = 'prof.dump'
log.info('Dumping profiler stats to: %s' % statfilename)
- prof.dump_stats(statfilename)
+ prof.dump_stats(statfilename)
def debug(got_error):
tb = None
@@ -248,7 +248,7 @@
if translateconfig.batch:
log.event("batch mode, not calling interactive helpers")
return
-
+
log.event("start debugger...")
if translateconfig.view:
@@ -295,7 +295,7 @@
samefile = this_exe.samefile(exe_name)
assert not samefile, (
'Output file %s is the currently running '
- 'interpreter (use --output=...)'% exe_name)
+ 'interpreter (use --output=...)' % exe_name)
except EnvironmentError:
pass
More information about the pypy-commit
mailing list