[pypy-svn] r32730 - in pypy/branch/config-in-more-places/pypy: bin tool
cfbolz at codespeak.net
cfbolz at codespeak.net
Fri Sep 29 11:10:07 CEST 2006
Author: cfbolz
Date: Fri Sep 29 11:10:05 2006
New Revision: 32730
Modified:
pypy/branch/config-in-more-places/pypy/bin/py.py
pypy/branch/config-in-more-places/pypy/tool/option.py
Log:
clean up option handling of py.py to use the config too. now you can start
py.py and specify that you want strdicts, for example.
Modified: pypy/branch/config-in-more-places/pypy/bin/py.py
==============================================================================
--- pypy/branch/config-in-more-places/pypy/bin/py.py (original)
+++ pypy/branch/config-in-more-places/pypy/bin/py.py Fri Sep 29 11:10:05 2006
@@ -26,8 +26,9 @@
module_args = []
def get_main_options():
- options = option.get_standard_options()
+ config, parser = option.get_standard_options()
+ options = []
options.append(make_option(
'-v', action='store_true', dest='verbose',
help='show verbose interpreter-level traceback'))
@@ -63,19 +64,19 @@
callback=runmodule_callback, type="string",
help="library module to be run as a script (terminates option list)"))
-
+ parser.add_options(options)
- return options
+ return config, parser
def main_(argv=None):
- starttime = time.time()
- args = option.process_options(get_main_options(), Options, argv[1:])
+ starttime = time.time()
+ config, parser = get_main_options()
+ args = option.process_options(parser, Options, argv[1:])
if Options.verbose:
error.RECORD_INTERPLEVEL_TRACEBACK = True
# create the object space
- config = option.make_config(Options)
space = option.make_objspace(config)
space._starttime = starttime
Modified: pypy/branch/config-in-more-places/pypy/tool/option.py
==============================================================================
--- pypy/branch/config-in-more-places/pypy/tool/option.py (original)
+++ pypy/branch/config-in-more-places/pypy/tool/option.py Fri Sep 29 11:10:05 2006
@@ -2,6 +2,8 @@
# XXX needs clean-up and reorganization.
import os
+from pypy.config.pypyoption import pypy_optiondescription
+from pypy.config.config import Config, to_optparse
from py.compat import optparse
make_option = optparse.make_option
@@ -14,7 +16,7 @@
compiler = "ast"
# "ast" uses interpreter/pyparser & interpreter/astcompiler.py
# "cpython" uses cpython parser and cpython c-level compiler
- usemodules = []
+ usemodules = []
version = "2.5a" # "native" / "2.3" / "2.4" / "2.5a"
def run_tb_server(option, opt, value, parser):
@@ -23,48 +25,17 @@
def get_standard_options():
- options = []
-
- def usemodules_callback(option, opt, value, parser):
- parser.values.usemodules.append(value)
-
- options.append(make_option(
- '-o', '--objspace', action="store", type="string", dest="objspace",
- help="object space to run PyPy on."))
- options.append(make_option(
- '--usemodules', action="callback", metavar='NAME',
- callback=usemodules_callback, type="string",
- help="(mixed) modules to use."))
- options.append(make_option(
- '--oldstyle', action="store_true", dest="oldstyle",
- help="enable oldstyle classes as default metaclass (std objspace only)"))
- options.append(make_option(
- '--uselibfile', action="store_true", dest="uselibfile",
- help="enable our custom file implementation"))
- options.append(make_option(
- '--nofaking', action="store_true", dest="nofaking",
- help="avoid faking of modules or objects"))
- options.append(make_option(
+ config = Config(pypy_optiondescription)
+ parser = to_optparse(config)
+ parser.add_option(
'-H', action="callback",
callback=run_tb_server,
- help="use web browser for traceback info"))
- options.append(make_option(
- '--compiler', action="store", type="string", dest="compiler",
- default=None,
- help="""select compiling approach. see pypy/doc/README.compiling""",
- metavar="[ast|cpython]"))
- options.append(make_option(
- '--parser', action="store",type="string", dest="parser", default=None,
- help="select the parser module to use",
- metavar="[pypy|cpython]"))
-
- return options
+ help="use web browser for traceback info")
+ return config, parser
-def process_options(optionlist, input_options, argv=None):
+def process_options(op, input_options, argv=None):
global Options
Options = input_options
- op = optparse.OptionParser()
- op.add_options(optionlist)
op.disable_interspersed_args()
options, args = op.parse_args(argv, input_options)
return args
More information about the Pypy-commit
mailing list