[pypy-svn] r23395 - pypy/dist/pypy/translator/goal

nik at codespeak.net nik at codespeak.net
Thu Feb 16 11:05:51 CET 2006


Author: nik
Date: Thu Feb 16 11:05:49 2006
New Revision: 23395

Modified:
   pypy/dist/pypy/translator/goal/targetpypystandalone.py
Log:
added --usemodules option to pypy target. for example you can now translate with
--usemodules=_socket (which fails currently ...)


Modified: pypy/dist/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetpypystandalone.py	(original)
+++ pypy/dist/pypy/translator/goal/targetpypystandalone.py	Thu Feb 16 11:05:49 2006
@@ -50,10 +50,12 @@
 
 def opt_parser():
     import py
-    defl = {'thread': False}
+    defl = {'thread': False, 'usemodules': ''}
     parser = py.compat.optparse.OptionParser(usage="target PyPy standalone", add_help_option=False)
     parser.set_defaults(**defl)
     parser.add_option("--thread", action="store_true", dest="thread", help="enable threading")
+    parser.add_option("--usemodules", action="store", type="string", dest="usemodules",
+            help="list of mixed modules to include, comma-separated")
     return parser
 
 def print_help():
@@ -67,8 +69,6 @@
 
     translate_pypy.log_options(tgt_options, "target PyPy options in effect")
 
-    options.thread = tgt_options.thread
-
     global space, w_entry_point
 
     geninterp = not getattr(options, 'lowmem', False)
@@ -82,7 +82,10 @@
     StdObjSpace.setup_old_style_classes = lambda self: None
 
     usemodules = []
-    if options.thread:
+    if tgt_options.usemodules:
+        usemodules.extend(tgt_options.usemodules.split(","))
+    if tgt_options.thread:
+        # thread might appear twice now, but the objspace can handle this
         usemodules.append('thread')
     if options.stackless:
         usemodules.append('stackless')



More information about the Pypy-commit mailing list