[pypy-svn] r47014 - in pypy/branch/dynamic-old-style/pypy: config lib/pyontology/test translator/goal

pedronis at codespeak.net pedronis at codespeak.net
Sat Sep 29 12:49:43 CEST 2007


Author: pedronis
Date: Sat Sep 29 12:49:43 2007
New Revision: 47014

Modified:
   pypy/branch/dynamic-old-style/pypy/config/pypyoption.py
   pypy/branch/dynamic-old-style/pypy/lib/pyontology/test/test_sparql.py
   pypy/branch/dynamic-old-style/pypy/translator/goal/app_main.py
   pypy/branch/dynamic-old-style/pypy/translator/goal/targetpypystandalone.py
Log:
pare down 46896 dynamic old-style changes to be much more backward compatible for the sake
of lib-python/conftest.py and the nightly pypy-c testing



Modified: pypy/branch/dynamic-old-style/pypy/config/pypyoption.py
==============================================================================
--- pypy/branch/dynamic-old-style/pypy/config/pypyoption.py	(original)
+++ pypy/branch/dynamic-old-style/pypy/config/pypyoption.py	Sat Sep 29 12:49:43 2007
@@ -238,7 +238,7 @@
 
         BoolOption("oldstyle",
                    "specify whether the default metaclass should be classobj",
-                   default=False, cmdline="--oldstyle"),
+                   default=False, cmdline="-k --oldstyle"),
 
         BoolOption("logspaceoptypes",
                    "a instrumentation option: before exit, print the types seen by "

Modified: pypy/branch/dynamic-old-style/pypy/lib/pyontology/test/test_sparql.py
==============================================================================
--- pypy/branch/dynamic-old-style/pypy/lib/pyontology/test/test_sparql.py	(original)
+++ pypy/branch/dynamic-old-style/pypy/lib/pyontology/test/test_sparql.py	Sat Sep 29 12:49:43 2007
@@ -500,4 +500,4 @@
 if check_have_oldstyle():
     TestXMLRPC = _TestXMLRPC
 else:
-    py.test.skip('Please build PyPy with --oldstyle, needed by xmlrpclib')
+    py.test.skip('Please run PyPy with --oldstyle, needed by xmlrpclib')

Modified: pypy/branch/dynamic-old-style/pypy/translator/goal/app_main.py
==============================================================================
--- pypy/branch/dynamic-old-style/pypy/translator/goal/app_main.py	(original)
+++ pypy/branch/dynamic-old-style/pypy/translator/goal/app_main.py	Sat Sep 29 12:49:43 2007
@@ -3,15 +3,17 @@
 # See test/test_app_main.
 """
 options:
-  -i           inspect interactively after running script
-  -O           dummy optimization flag for compatibility with C Python
-  -c CMD       program passed in as CMD (terminates option list)
-  -S           do not 'import site' on initialization
-  -u           unbuffered binary stdout and stderr
-  -h, --help   show this help message and exit
-  -m           library module to be run as a script (terminates option list)
-  --version    print the PyPy version
-  --info       print translation information about this PyPy executable
+  -i             inspect interactively after running script
+  -O             dummy optimization flag for compatibility with C Python
+  -c CMD         program passed in as CMD (terminates option list)
+  -S             do not 'import site' on initialization
+  -u             unbuffered binary stdout and stderr
+  -h, --help     show this help message and exit
+  -m             library module to be run as a script (terminates option list)
+  -k, --oldstyle use old-style classes instead of newstyle classes
+                 everywhere %(oldstyle)s
+  --version      print the PyPy version
+  --info         print translation information about this PyPy executable
 """
 
 import sys, os
@@ -121,7 +123,10 @@
 
 def print_help():
     print 'usage: %s [options]' % (sys.executable,)
-    print __doc__
+    details = {'oldstyle': ''}
+    if sys.pypy_translation_info['objspace.std.oldstyle']:
+        details['oldstyle'] = '[default]'
+    print __doc__ % details
 
 def print_error(msg):
     print >> sys.stderr, msg
@@ -179,6 +184,7 @@
     i = 0
     run_module = False
     run_stdin = False
+    oldstyle_classes = False
     while i < len(argv):
         arg = argv[i]
         if not arg.startswith('-'):
@@ -216,6 +222,8 @@
                 return 2
             run_module = True
             break
+        elif arg in ('-k', '--oldstyle'):
+            oldstyle_classes = True
         elif arg == '--':
             i += 1
             break     # terminates option list
@@ -235,6 +243,10 @@
     mainmodule = type(sys)('__main__')
     sys.modules['__main__'] = mainmodule
 
+    if oldstyle_classes:
+        import __builtin__
+        __builtin__.__metaclass__ = __builtin__._classobj
+
     if import_site:
         try:
             import site

Modified: pypy/branch/dynamic-old-style/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/branch/dynamic-old-style/pypy/translator/goal/targetpypystandalone.py	(original)
+++ pypy/branch/dynamic-old-style/pypy/translator/goal/targetpypystandalone.py	Sat Sep 29 12:49:43 2007
@@ -170,10 +170,6 @@
     def get_entry_point(self, config):
         space = make_objspace(config)
 
-        if not config.objspace.std.oldstyle:
-            # disable translation of the whole of classobjinterp.py
-            StdObjSpace.setup_old_style_classes = lambda self: None
-
         # manually imports app_main.py
         filename = os.path.join(this_dir, 'app_main.py')
         w_dict = space.newdict()



More information about the Pypy-commit mailing list