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

pedronis at codespeak.net pedronis at codespeak.net
Fri Sep 30 00:35:18 CEST 2005


Author: pedronis
Date: Fri Sep 30 00:35:17 2005
New Revision: 17987

Modified:
   pypy/dist/pypy/translator/goal/targetpypystandalone.py
   pypy/dist/pypy/translator/goal/translate_pypy.py
Log:
more forward compatibility



Modified: pypy/dist/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetpypystandalone.py	(original)
+++ pypy/dist/pypy/translator/goal/targetpypystandalone.py	Fri Sep 30 00:35:17 2005
@@ -50,16 +50,16 @@
     geninterp = not getattr(options, 'lowmem', False)
     
     # obscure hack to stuff the translation options into the translated PyPy
-    import __main__, pypy.module.sys
-    options = {}
-    for key, value in __main__.options.items():
-        options[key.lstrip('-')] = value
-    wrapstr = 'space.wrap(%r)' % (options,)
+    import pypy.module.sys
+    d = {}
+    for key, value in options.__dict__.items():
+        d[key.lstrip('-')] = value
+    wrapstr = 'space.wrap(%r)' % (d,)
     pypy.module.sys.Module.interpleveldefs['pypy_translation_info'] = wrapstr
 
     # disable translation of the whole of classobjinterp.py
     StdObjSpace.setup_old_style_classes = lambda self: None
-    if __main__.options.get('-boehm'):
+    if options.gc == 'boehm':
         #print "disabling thread with boehm for stabilitiy (combination not tested)"
         #print "trying threads and boehm"
         usemodules = []

Modified: pypy/dist/pypy/translator/goal/translate_pypy.py
==============================================================================
--- pypy/dist/pypy/translator/goal/translate_pypy.py	(original)
+++ pypy/dist/pypy/translator/goal/translate_pypy.py	Fri Sep 30 00:35:17 2005
@@ -110,8 +110,17 @@
     if target:
         # forward compatibility
         import optparse
-        opts = optparse.Values({'lowmem': options['-t-lowmem']})
-        spec = target(opts, [])
+        fw_opts = options.copy()
+        if options['-boehm']:
+            gc_ = 'boehm'
+        elif options['-no-gc']:
+            gc_ = 'none'
+        else:
+            gc_ = 'ref'
+        fw_opts['gc'] = gc_
+        fw_opts['lowmem'] = options['-t-lowmem']
+        fw_opts = optparse.Values(fw_opts)
+        spec = target(fw_opts, [])
         try:
             entry_point, inputtypes, policy = spec
         except ValueError:



More information about the Pypy-commit mailing list