Hello community,

here is the log from the commit of package python-py for openSUSE:Factory 
checked in at 2013-06-29 14:33:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-py (Old)
 and      /work/SRC/openSUSE:Factory/.python-py.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-py"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-py/python-py.changes      2013-06-05 
13:35:55.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-py.new/python-py.changes 2013-06-29 
14:33:51.000000000 +0200
@@ -1,0 +2,9 @@
+Tue Jun 25 11:45:11 UTC 2013 - [email protected]
+
+- update to 1.4.15:
+  - majorly speed up some common calling patterns with
+    LocalPath.listdir()/join/check/stat functions considerably.
+  - fix an edge case with fnmatch where a glob style pattern appeared
+    in an absolute path.
+
+-------------------------------------------------------------------

Old:
----
  py-1.4.14.tar.gz

New:
----
  py-1.4.15.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-py.spec ++++++
--- /var/tmp/diff_new_pack.kzwpX8/_old  2013-06-29 14:33:51.000000000 +0200
+++ /var/tmp/diff_new_pack.kzwpX8/_new  2013-06-29 14:33:51.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           python-py
-Version:        1.4.14
+Version:        1.4.15
 Release:        0
 Summary:        Library with cross-python path, ini-parsing, io, code, log 
facilities
 License:        MIT

++++++ py-1.4.14.tar.gz -> py-1.4.15.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/CHANGELOG new/py-1.4.15/CHANGELOG
--- old/py-1.4.14/CHANGELOG     2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/CHANGELOG     2013-06-21 16:36:31.000000000 +0200
@@ -1,3 +1,12 @@
+Changes between 1.4.14 and 1.4.15
+==================================================
+
+- majorly speed up some common calling patterns with
+  LocalPath.listdir()/join/check/stat functions considerably.
+
+- fix an edge case with fnmatch where a glob style pattern appeared
+  in an absolute path.
+
 Changes between 1.4.13 and 1.4.14
 ==================================================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/PKG-INFO new/py-1.4.15/PKG-INFO
--- old/py-1.4.14/PKG-INFO      2013-05-07 10:40:24.000000000 +0200
+++ new/py-1.4.15/PKG-INFO      2013-06-21 16:36:31.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: py
-Version: 1.4.14
+Version: 1.4.15
 Summary: library with cross-python path, ini-parsing, io, code, log facilities
 Home-page: http://pylib.readthedocs.org/
 Author: holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/doc/install.txt 
new/py-1.4.15/doc/install.txt
--- old/py-1.4.14/doc/install.txt       2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/doc/install.txt       2013-06-21 16:36:31.000000000 +0200
@@ -7,7 +7,7 @@
 
 **PyPI name**: py_
 
-**Pythons**: 2.5, 2.6, 2.7, 3.0, 3.1.x, Jython-2.5.1, PyPy-1.3
+**Pythons**: 2.5, 2.6, 2.7, 3.2, 3.3, Jython-2.5.1, PyPy-2.0
 
 **Operating systems**: Linux, Windows, OSX, Unix
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/doc/log.txt new/py-1.4.15/doc/log.txt
--- old/py-1.4.14/doc/log.txt   2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/doc/log.txt   2013-06-21 16:36:31.000000000 +0200
@@ -163,7 +163,7 @@
 
 Each log producer may have at most one log consumer associated with
 it.  A log producer gets associated with a log consumer through a
-``py.log.set_consumer()`` call.  That function accepts two arguments,
+``py.log.setconsumer()`` call.  That function accepts two arguments,
 the first identifying a producer (a tuple of keyword strings or a single
 space-separated string of keywords), the second specifying the precise
 consumer to use for that producer.  Until this function is called for a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/py/__init__.py new/py-1.4.15/py/__init__.py
--- old/py-1.4.14/py/__init__.py        2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/py/__init__.py        2013-06-21 16:36:31.000000000 +0200
@@ -8,7 +8,7 @@
 
 (c) Holger Krekel and others, 2004-2013
 """
-__version__ = '1.4.14'
+__version__ = '1.4.15'
 
 from py import _apipkg
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/py/_path/common.py 
new/py-1.4.15/py/_path/common.py
--- old/py-1.4.14/py/_path/common.py    2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/py/_path/common.py    2013-06-21 16:36:31.000000000 +0200
@@ -364,12 +364,14 @@
 class FNMatcher:
     def __init__(self, pattern):
         self.pattern = pattern
+
     def __call__(self, path):
         pattern = self.pattern
         if pattern.find(path.sep) == -1:
             name = path.basename
         else:
             name = str(path) # path.strpath # XXX svn?
-            pattern = '*' + path.sep + pattern
+            if not os.path.isabs(pattern):
+                pattern = '*' + path.sep + pattern
         return py.std.fnmatch.fnmatch(name, pattern)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/py/_path/local.py 
new/py-1.4.15/py/_path/local.py
--- old/py-1.4.14/py/_path/local.py     2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/py/_path/local.py     2013-06-21 16:36:31.000000000 +0200
@@ -4,9 +4,18 @@
 import sys, os, stat, re, atexit
 import py
 from py._path import common
+from stat import S_ISLNK, S_ISDIR, S_ISREG
+
+from os.path import normpath, isabs, exists, isdir, isfile
 
 iswin32 = sys.platform == "win32" or (getattr(os, '_name', False) == 'nt')
 
+if sys.version_info > (3,0):
+    def map_as_list(func, iter):
+        return list(map(func, iter))
+else:
+    map_as_list = map
+
 class Stat(object):
     def __getattr__(self, name):
         return getattr(self._osstatresult, "st_" + name)
@@ -33,14 +42,14 @@
         return entry[0]
 
     def isdir(self):
-        return stat.S_ISDIR(self.mode)
+        return S_ISDIR(self._osstatresult.st_mode)
 
     def isfile(self):
-        return stat.S_ISREG(self.mode)
+        return S_ISREG(self._osstatresult.st_mode)
 
     def islink(self):
         st = self.path.lstat()
-        return stat.S_ISLNK(st.mode)
+        return S_ISLNK(self._osstatresult.st_mode)
 
 class PosixPath(common.PathBase):
     def chown(self, user, group, rec=0):
@@ -112,17 +121,17 @@
                 return self._statcache
 
         def dir(self):
-            return stat.S_ISDIR(self._stat().mode)
+            return S_ISDIR(self._stat().mode)
 
         def file(self):
-            return stat.S_ISREG(self._stat().mode)
+            return S_ISREG(self._stat().mode)
 
         def exists(self):
             return self._stat()
 
         def link(self):
             st = self.path.lstat()
-            return stat.S_ISLNK(st.mode)
+            return S_ISLNK(st.mode)
 
     def __init__(self, path=None):
         """ Initialize and return a local Path instance.
@@ -138,7 +147,7 @@
         elif isinstance(path, common.PathBase):
             self.strpath = path.strpath
         elif isinstance(path, py.builtin._basestring):
-            self.strpath = os.path.abspath(os.path.normpath(str(path)))
+            self.strpath = os.path.abspath(normpath(str(path)))
         else:
             raise ValueError("can only pass None, Path instances "
                              "or non-empty strings to LocalPath")
@@ -226,6 +235,9 @@
                                      xxx   ext
         """
         obj = object.__new__(self.__class__)
+        if not kw:
+            obj.strpath = self.strpath
+            return obj
         drive, dirname, basename, purebasename,ext = self._getbyspec(
              "drive,dirname,basename,purebasename,ext")
         if 'basename' in kw:
@@ -247,7 +259,7 @@
         else:
             kw.setdefault('dirname', dirname)
         kw.setdefault('sep', self.sep)
-        obj.strpath = os.path.normpath(
+        obj.strpath = normpath(
             "%(dirname)s%(sep)s%(basename)s" % kw)
         return obj
 
@@ -286,46 +298,69 @@
         components.  if abs=1 is used restart from root if any
         of the args is an absolute path.
         """
-        if not args:
-            return self
-        strpath = self.strpath
         sep = self.sep
-        strargs = [str(x) for x in args]
-        if kwargs.get('abs', 0):
-            for i in range(len(strargs)-1, -1, -1):
-                if os.path.isabs(strargs[i]):
-                    strpath = strargs[i]
-                    strargs = strargs[i+1:]
+        strargs = map_as_list(str, args)
+        strpath = self.strpath
+        if kwargs.get('abs'):
+            newargs = []
+            for arg in reversed(strargs):
+                if isabs(arg):
+                    strpath = arg
+                    strargs = newargs
                     break
+                newargs.insert(0, arg)
         for arg in strargs:
             arg = arg.strip(sep)
             if iswin32:
                 # allow unix style paths even on windows.
                 arg = arg.strip('/')
                 arg = arg.replace('/', sep)
-            if arg:
-                if not strpath.endswith(sep):
-                    strpath += sep
-                strpath += arg
-        obj = self.new()
-        obj.strpath = os.path.normpath(strpath)
+            strpath = strpath + sep + arg
+        obj = object.__new__(self.__class__)
+        obj.strpath = normpath(strpath)
         return obj
 
     def open(self, mode='r'):
         """ return an opened file with the given mode. """
         return py.error.checked_call(open, self.strpath, mode)
 
+    def _fastjoin(self, name):
+        child = object.__new__(self.__class__)
+        child.strpath = self.strpath + self.sep + name
+        return child
+
+    _fastcheck = set("file dir link")
+    def check(self, **kw):
+        if not kw:
+            return exists(self.strpath)
+        if len(kw) == 1:
+            if "dir" in kw:
+                return not kw["dir"] ^ isdir(self.strpath)
+            if "file" in kw:
+                return not kw["file"] ^ isfile(self.strpath)
+        return super(LocalPath, self).check(**kw)
+
+    _patternchars = set("*?[" + os.path.sep)
     def listdir(self, fil=None, sort=None):
         """ list directory contents, possibly filter by the given fil func
             and possibly sorted.
         """
+        if fil is None and sort is None:
+            names = py.error.checked_call(os.listdir, self.strpath)
+            return map_as_list(self._fastjoin, names)
         if isinstance(fil, str):
+            if not self._patternchars.intersection(fil):
+                child = self._fastjoin(fil)
+                if os.path.exists(child.strpath):
+                    return [child]
+                return []
             fil = common.FNMatcher(fil)
+        names = py.error.checked_call(os.listdir, self.strpath)
         res = []
-        for name in py.error.checked_call(os.listdir, self.strpath):
-            childurl = self.join(name)
-            if fil is None or fil(childurl):
-                res.append(childurl)
+        for name in names:
+            child = self._fastjoin(name)
+            if fil is None or fil(child):
+                res.append(child)
         self._sortlist(res, sort)
         return res
 
@@ -587,9 +622,9 @@
             The process is directly invoked and not through a system shell.
         """
         from subprocess import Popen, PIPE
-        argv = map(str, argv)
+        argv = map_as_list(str, argv)
         popen_opts['stdout'] = popen_opts['stderr'] = PIPE
-        proc = Popen([str(self)] + list(argv), **popen_opts)
+        proc = Popen([str(self)] + argv, **popen_opts)
         stdout, stderr = proc.communicate()
         ret = proc.wait()
         if py.builtin._isbytes(stdout):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/py.egg-info/PKG-INFO 
new/py-1.4.15/py.egg-info/PKG-INFO
--- old/py-1.4.14/py.egg-info/PKG-INFO  2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/py.egg-info/PKG-INFO  2013-06-21 16:36:31.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: py
-Version: 1.4.14
+Version: 1.4.15
 Summary: library with cross-python path, ini-parsing, io, code, log facilities
 Home-page: http://pylib.readthedocs.org/
 Author: holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/setup.py new/py-1.4.15/setup.py
--- old/py-1.4.14/setup.py      2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/setup.py      2013-06-21 16:36:31.000000000 +0200
@@ -12,7 +12,7 @@
         name='py',
         description='library with cross-python path, ini-parsing, io, code, 
log facilities',
         long_description = open('README.txt').read(),
-        version='1.4.14',
+        version='1.4.15',
         url='http://pylib.readthedocs.org/',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/testing/path/test_local.py 
new/py-1.4.15/testing/path/test_local.py
--- old/py-1.4.14/testing/path/test_local.py    2013-05-07 10:40:23.000000000 
+0200
+++ new/py-1.4.15/testing/path/test_local.py    2013-06-21 16:36:31.000000000 
+0200
@@ -221,6 +221,12 @@
         # check that breadth comes last
         assert l[0] == p1
 
+    def test_fnmatch_file_abspath(self, tmpdir):
+        b = tmpdir.join("a", "b")
+        assert b.fnmatch(os.sep.join("ab"))
+        pattern = os.sep.join([str(tmpdir), "*", "b"])
+        assert b.fnmatch(pattern)
+
     def test_sysfind(self):
         name = sys.platform == "win32" and "cmd" or "test"
         x = py.path.local.sysfind(name)
@@ -454,6 +460,10 @@
         p2 = p.__class__(str(p).upper())
         assert p1.samefile(p2)
 
+def test_listdir_single_arg(tmpdir):
+    tmpdir.ensure("hello")
+    assert tmpdir.listdir("hello")[0].basename == "hello"
+
 def test_mkdtemp_rootdir(tmpdir):
     dtmp = local.mkdtemp(rootdir=tmpdir)
     assert tmpdir.listdir() == [dtmp]
@@ -640,7 +650,7 @@
     def test_join_to_root(self, path1):
         root = path1.parts()[0]
         assert len(str(root)) == 1
-        assert str(root.join('a')) == '/a'
+        assert str(root.join('a')) == '//a'  # posix allows two slashes
 
     def test_join_root_to_root_with_no_abs(self, path1):
         nroot = path1.join('/')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-1.4.14/tox.ini new/py-1.4.15/tox.ini
--- old/py-1.4.14/tox.ini       2013-05-07 10:40:23.000000000 +0200
+++ new/py-1.4.15/tox.ini       2013-06-21 16:36:31.000000000 +0200
@@ -1,5 +1,5 @@
 [tox]
-envlist=py26,py27,py31,py32,py33,py27-xdist,py25
+envlist=py26,py27,py32,py33,py27-xdist,py25
 #indexserver=
 #    default=http://pypi.testrun.org
 

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to