[pypy-svn] r34665 - in pypy/dist/pypy: config module/__builtin__

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Nov 16 14:02:18 CET 2006


Author: cfbolz
Date: Thu Nov 16 14:02:16 2006
New Revision: 34665

Modified:
   pypy/dist/pypy/config/pypyoption.py
   pypy/dist/pypy/module/__builtin__/importing.py
Log:
add a config option to make it possible to completely disable pyc files


Modified: pypy/dist/pypy/config/pypyoption.py
==============================================================================
--- pypy/dist/pypy/config/pypyoption.py	(original)
+++ pypy/dist/pypy/config/pypyoption.py	Thu Nov 16 14:02:16 2006
@@ -58,6 +58,9 @@
         BoolOption("logbytecodes",
                    "keep track of bytecode usage",
                    default=False),
+
+        BoolOption("usepycfiles", "Write and read pyc files when importing",
+                   default=True),
        
         OptionDescription("std", "Standard Object Space Options", [
             BoolOption("withtproxy", "support transparent proxies",

Modified: pypy/dist/pypy/module/__builtin__/importing.py
==============================================================================
--- pypy/dist/pypy/module/__builtin__/importing.py	(original)
+++ pypy/dist/pypy/module/__builtin__/importing.py	Thu Nov 16 14:02:16 2006
@@ -16,8 +16,6 @@
 PYFILE = 1
 PYCFILE = 2
 
-PYC_ONOFF = True
-
 def info_modtype(space, filepart):
     """
     calculate whether the .py file exists, the .pyc file exists
@@ -36,7 +34,7 @@
         pyfile_exist = False
     
     pycfile = filepart + ".pyc"    
-    if PYC_ONOFF and os.path.exists(pycfile):
+    if space.config.objspace.usepycfiles and os.path.exists(pycfile):
         pyc_state = check_compiled_module(space, pyfile, pyfile_ts, pycfile)
         pycfile_exists = pyc_state >= 0
         pycfile_ts_valid = pyc_state > 0 or (pyc_state == 0 and not pyfile_exist)
@@ -358,7 +356,7 @@
                       w(space.builtin))
     pycode.exec_code(space, w_dict, w_dict)
 
-    if PYC_ONOFF:
+    if space.config.objspace.usepycfiles:
         mtime = os.stat(pathname)[stat.ST_MTIME]
         cpathname = pathname + 'c'
         write_compiled_module(space, pycode, cpathname, mtime)



More information about the Pypy-commit mailing list