[pypy-svn] r4776 - in pypy/trunk/src: . pypy/tool pypy/translator/tool

hpk at codespeak.net hpk at codespeak.net
Mon May 31 18:40:01 CEST 2004


Author: hpk
Date: Mon May 31 18:40:00 2004
New Revision: 4776

Modified:
   pypy/trunk/src/   (props changed)
   pypy/trunk/src/pypy/tool/newtest.py
   pypy/trunk/src/pypy/tool/testit.py
   pypy/trunk/src/pypy/tool/udir.py
   pypy/trunk/src/pypy/translator/tool/buildcl.py
   pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py
   pypy/trunk/src/pypy/translator/tool/make_dot.py
Log:
scrap vpath, used 'std' 


Modified: pypy/trunk/src/pypy/tool/newtest.py
==============================================================================
--- pypy/trunk/src/pypy/tool/newtest.py	(original)
+++ pypy/trunk/src/pypy/tool/newtest.py	Mon May 31 18:40:00 2004
@@ -71,7 +71,7 @@
 import sys
 import traceback
 import types
-import vpath
+from std import path 
 
 #TODO
 # - add support for ignored tests (do we need to differentiate between
@@ -529,12 +529,12 @@
         by scanning the start directory recursively.
         """
         items = []
-        dirname = vpath.getlocal(dirname)
+        dirname = path.local(dirname)
 
         def testfilefilter(path):
-            return path.isfile() and path.fnmatch('test_*.py')
+            return path.check(file=1, fnmatch='test_*.py')
         def recfilter(path):
-            return recursive and vpath.nodotfile(path)
+            return recursive and path.check(dotfile=0) 
 
         for testfn in dirname.visit(testfilefilter, recfilter):
             # strip the leading pypy directory and the .py suffix

Modified: pypy/trunk/src/pypy/tool/testit.py
==============================================================================
--- pypy/trunk/src/pypy/tool/testit.py	(original)
+++ pypy/trunk/src/pypy/tool/testit.py	Mon May 31 18:40:00 2004
@@ -242,8 +242,8 @@
     Additionally, their fully qualified python module path has
     to be accepted by filterfunc (if it is not None).
     """
-    from vpath import getlocal, nodotfile
-    root = getlocal(root)
+    from std import path 
+    root = path.local(root)
 
     if Options.verbose > 2:
         print >> sys.stderr, "scanning for test files in", root
@@ -251,10 +251,10 @@
     if loader is None:
         loader = unittest.TestLoader()
 
-    def testfilefilter(path):
-        return path.isfile() and path.fnmatch('test_*.py')
-    def recfilter(path):
-        return recursive and nodotfile(path) 
+    def testfilefilter(p):
+        return p.check(file=1, fnmatch='test_*.py') 
+    def recfilter(p):
+        return recursive and p.check(dotfile=0) 
     
     suite = unittest.TestLoader.suiteClass()
 

Modified: pypy/trunk/src/pypy/tool/udir.py
==============================================================================
--- pypy/trunk/src/pypy/tool/udir.py	(original)
+++ pypy/trunk/src/pypy/tool/udir.py	Mon May 31 18:40:00 2004
@@ -1,6 +1,6 @@
 import autopath
 
-from vpath.local import make_numbered_dir
+from std.path import local 
 
-udir = make_numbered_dir(base='usession-', keep=3)
+udir = local.make_numbered_dir(base='usession-', keep=3)
 

Modified: pypy/trunk/src/pypy/translator/tool/buildcl.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/buildcl.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/buildcl.py	Mon May 31 18:40:00 2004
@@ -2,7 +2,7 @@
 
 from pypy.objspace.flow import FlowObjSpace
 from pypy.translator.gencl import GenCL
-from vpath.adapter.process import exec_cmd
+from std.process import cmdexec 
 
 class Literal:
     def __init__(self, val):
@@ -56,7 +56,7 @@
             print >>fp, writelisp(gen, arg),
         print >>fp, "))"
         fp.close()
-        output = exec_cmd("%s %s" % (cl, str(fpath)))
+        output = cmdexec("%s %s" % (cl, str(fpath)))
         return readlisp(output)
     return _
 

Modified: pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py	Mon May 31 18:40:00 2004
@@ -2,8 +2,8 @@
 from pypy.tool import testit
 from pypy.tool.udir import udir
 
-from vpath.adapter.process import exec_cmd
-from vpath.local import Path
+from std.process import cmdexec 
+from std import path 
 from pypy.translator.genpyrex import GenPyrex
 
 import os, sys, inspect
@@ -12,11 +12,11 @@
 debug = 0
 
 def make_module_from_pyxstring(name, dirpath, string):
-    dirpath = Path(dirpath)
+    dirpath = path.local(dirpath)
     pyxfile = dirpath.join('%s.pyx' % name) 
     i = 0
-    while pyxfile.exists():
-        pyxfile = pyxfile.newbasename('%s%d.pyx' % (name, i))
+    while pyxfile.check():
+        pyxfile = pyxfile.new(basename='%s%d.pyx' % (name, i))
     pyxfile.write(string)
     if debug: print "made pyxfile", pyxfile
     make_c_from_pyxfile(pyxfile)
@@ -36,11 +36,11 @@
     #    print "ERROR IMPORTING"
     #    pass
 
-    dirpath = pyxfile.dirname()
-    lastdir = Path()
+    dirpath = pyxfile.dirpath()
+    lastdir = path.local()
     os.chdir(str(dirpath))
     try:
-        modname = pyxfile.purebasename()
+        modname = pyxfile.get('purebasename') 
         if debug: print "modname", modname
         c = stdoutcapture.Capture(mixed_out_err = True)
         try:
@@ -86,7 +86,7 @@
             raise ValueError, "failure %s" % result
     except PyrexError, e:
         print >>sys.stderr, e
-    cfile = pyxfile.newext('.c')
+    cfile = pyxfile.new(ext='.c')
 
 def build_cfunc(func, simplify=1, dot=1, inputargtypes=None):
     """ return a pyrex-generated cfunction from the given func. 
@@ -109,7 +109,7 @@
 
     if not inputargtypes: 
         source = inspect.getsource(func)
-        base = udir.join(name).newext('.py').write(source) 
+        base = udir.join(name).new(ext='.py').write(source) 
 
     if dot:
         from pypy.translator.tool.make_dot import DotGen
@@ -149,10 +149,10 @@
             subgraphs.append(dotgen.getsubgraph(name, funcgraph))
         content = dotgen.getgraph("graph_"+func.func_name, subgraphs)
         base = udir.join(name)
-        base.newext('dot').write(content)
-        base.newext('ps')
-        exec_cmd('dot -Tps -o %s %s' % (
-            str(base.newext('ps')),
-            str(base.newext('.dot'))))
+        base.new(ext='dot').write(content)
+        base.new(ext='ps')
+        cmdexec('dot -Tps -o %s %s' % (
+            str(base.new(ext='ps')),
+            str(base.new(ext='.dot'))))
 
     return getattr(mod, func.func_name)

Modified: pypy/trunk/src/pypy/translator/tool/make_dot.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/make_dot.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/make_dot.py	Mon May 31 18:40:00 2004
@@ -7,6 +7,7 @@
 from pypy.objspace.flow.model import *
 from pypy.objspace.flow import Space
 from pypy.tool.udir import udir
+from std.process import cmdexec
 
 debug = 0
 
@@ -137,8 +138,6 @@
     os.system('gv %s' % fn)
 
 def make_dot_graphs(basefilename, graphs, storedir=None, target='ps'):
-    from vpath.adapter.process import exec_cmd
-
     if storedir is None:
         storedir = udir
 
@@ -160,7 +159,7 @@
     #print source
     dest.write(source)
     psdest = dest.newext(target)
-    out = exec_cmd('dot -T%s %s' % (target, str(dest)))
+    out = cmdexec('dot -T%s %s' % (target, str(dest)))
     psdest.write(out)
     #print "wrote", psdest
     return psdest



More information about the Pypy-commit mailing list