[pypy-svn] r79117 - in pypy/trunk/pypy: config translator/goal

arigo at codespeak.net arigo at codespeak.net
Mon Nov 15 18:32:53 CET 2010


Author: arigo
Date: Mon Nov 15 18:32:51 2010
New Revision: 79117

Modified:
   pypy/trunk/pypy/config/pypyoption.py
   pypy/trunk/pypy/translator/goal/targetpypystandalone.py
Log:
Add the translation option --translationmodules to pypy.
Enables precisely those modules that are needed to run
a translation of pypy on top of the generated pypy.


Modified: pypy/trunk/pypy/config/pypyoption.py
==============================================================================
--- pypy/trunk/pypy/config/pypyoption.py	(original)
+++ pypy/trunk/pypy/config/pypyoption.py	Mon Nov 15 18:32:51 2010
@@ -34,6 +34,11 @@
      "_bisect"]
 ))
 
+translation_modules = default_modules.copy()
+translation_modules.update(dict.fromkeys(
+    ["fcntl", "rctime", "select", "signal", "_rawffi", "zlib",
+     "struct", "md5", "cStringIO", "array"]))
+
 working_oo_modules = default_modules.copy()
 working_oo_modules.update(dict.fromkeys(
     ["md5", "sha", "cStringIO", "itertools"]
@@ -149,6 +154,12 @@
                cmdline="--allworkingmodules",
                negation=True),
 
+    BoolOption("translationmodules",
+          "use only those modules that are needed to run translate.py on pypy",
+               default=False,
+               cmdline="--translationmodules",
+               suggests=[("objspace.allworkingmodules", False)]),
+
     BoolOption("geninterp", "specify whether geninterp should be used",
                cmdline=None,
                default=True),
@@ -369,6 +380,11 @@
     modules = [name for name in modules if name not in essential_modules]
     config.objspace.usemodules.suggest(**dict.fromkeys(modules, True))
 
+def enable_translationmodules(config):
+    modules = translation_modules
+    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()

Modified: pypy/trunk/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/trunk/pypy/translator/goal/targetpypystandalone.py	(original)
+++ pypy/trunk/pypy/translator/goal/targetpypystandalone.py	Mon Nov 15 18:32:51 2010
@@ -150,6 +150,9 @@
         if config.objspace.allworkingmodules:
             from pypy.config.pypyoption import enable_allworkingmodules
             enable_allworkingmodules(config)
+        if config.objspace.translationmodules:
+            from pypy.config.pypyoption import enable_translationmodules
+            enable_translationmodules(config)
 
         if config.translation.type_system == 'ootype':
             config.objspace.usemodules.suggest(rbench=True)



More information about the Pypy-commit mailing list