[pypy-svn] r57516 - in pypy/dist/pypy: bin config doc/config translator/goal
arigo at codespeak.net
arigo at codespeak.net
Wed Aug 20 16:59:14 CEST 2008
Author: arigo
Date: Wed Aug 20 16:59:11 2008
New Revision: 57516
Modified:
pypy/dist/pypy/bin/py.py
pypy/dist/pypy/config/pypyoption.py
pypy/dist/pypy/doc/config/objspace.allworkingmodules.txt
pypy/dist/pypy/translator/goal/targetpypystandalone.py
Log:
Change the handling of --allworkingmodules to
let the list of modules be backend-specific.
Modified: pypy/dist/pypy/bin/py.py
==============================================================================
--- pypy/dist/pypy/bin/py.py (original)
+++ pypy/dist/pypy/bin/py.py Wed Aug 20 16:59:11 2008
@@ -16,6 +16,7 @@
from pypy.interpreter import main, interactive, error, gateway
from pypy.config.config import OptionDescription, BoolOption, StrOption
from pypy.config.config import Config, to_optparse
+from pypy.config import pypyoption
import os, sys
import time
@@ -58,6 +59,10 @@
args = option.process_options(parser, argv[1:])
if interactiveconfig.verbose:
error.RECORD_INTERPLEVEL_TRACEBACK = True
+ # --allworkingmodules takes really long to start up, but can be forced on
+ config.objspace.suggest(allworkingmodules=False)
+ if config.objspace.allworkingmodules:
+ pypyoption.enable_allworkingmodules(config)
# create the object space
Modified: pypy/dist/pypy/config/pypyoption.py
==============================================================================
--- pypy/dist/pypy/config/pypyoption.py (original)
+++ pypy/dist/pypy/config/pypyoption.py Wed Aug 20 16:59:11 2008
@@ -31,6 +31,11 @@
"thread"]
))
+working_oo_modules = default_modules.copy()
+working_oo_modules.update(dict.fromkeys(
+ [] # XXX at least, this probably works: "md5", "sha", "cStringIO"
+))
+
if sys.platform == "win32":
# unix only modules
del working_modules["crypt"]
@@ -131,14 +136,13 @@
for modname in all_modules]),
BoolOption("allworkingmodules", "use as many working modules as possible",
- # NB. defaults to False for py.py and tests, but
- # targetpypystandalone suggests True, which can be overridden
- # with --no-allworkingmodules.
- default=False,
+ # NB. defaults to True, but in py.py this is overridden by
+ # a False suggestion because it takes a while to start up.
+ # Actual module enabling only occurs if
+ # enable_allworkingmodules() is called, and it depends
+ # on the selected backend.
+ default=True,
cmdline="--allworkingmodules",
- suggests=[("objspace.usemodules.%s" % (modname, ), True)
- for modname in working_modules
- if modname in all_modules],
negation=True),
BoolOption("geninterp", "specify whether geninterp should be used",
@@ -366,6 +370,17 @@
config.objspace.std.suggest(multimethods="doubledispatch")
+def enable_allworkingmodules(config):
+ if config.translation.type_system == 'ootype':
+ modules = working_oo_modules
+ else:
+ modules = working_modules
+ # ignore names from 'essential_modules', notably 'exceptions', which
+ # may not be present in config.objspace.usemodules at all
+ modules = [name for name in modules if name not in essential_modules]
+ config.objspace.usemodules.suggest(**dict.fromkeys(modules, True))
+
+
if __name__ == '__main__':
config = get_pypy_config()
print config.getpaths()
Modified: pypy/dist/pypy/doc/config/objspace.allworkingmodules.txt
==============================================================================
--- pypy/dist/pypy/doc/config/objspace.allworkingmodules.txt (original)
+++ pypy/dist/pypy/doc/config/objspace.allworkingmodules.txt Wed Aug 20 16:59:11 2008
@@ -1,5 +1,6 @@
This option enables the usage of all modules that are known to be working well
and that translate without problems.
-Note that this option is set to True by default by targetpypystandalone.py.
-To force it to False, use ``--no-allworkingmodules``.
+Note that this option defaults to True (except when running
+``py.py`` because it takes a long time to start). To force it
+to False, use ``--no-allworkingmodules``.
Modified: pypy/dist/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetpypystandalone.py (original)
+++ pypy/dist/pypy/translator/goal/targetpypystandalone.py Wed Aug 20 16:59:11 2008
@@ -132,14 +132,9 @@
# expose the following variables to ease debugging
global space, entry_point
- # not really clean, but setting the default of allworkingmodules
- # to True has two problems: it doesn't implies its suggests (the
- # config machinery doesn't handle that case), and we don't want
- # allworkingmodules to be enabled for all spaces by default
- # (e.g. in py.py or in tests). Auto-generated helps report the
- # default of allworkingmodules to be False, though, which is a
- # bit annoying.
- config.objspace.suggest(allworkingmodules=True)
+ if config.objspace.allworkingmodules:
+ from pypy.config.pypyoption import enable_allworkingmodules
+ enable_allworkingmodules(config)
if config.translation.thread:
config.objspace.usemodules.thread = True
More information about the Pypy-commit
mailing list