Commits

holger krekel committed 6a80ab2

fix an edge case with fnmatch where a glob style pattern appeared
in an absolute path.

  • Participants
  • Parent commits 6e3522f

Comments (0)

Files changed (5)

+Changes between 1.4.14 and 1.4.15.dev
+==================================================
+
+- 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
 ==================================================
 
 
 (c) Holger Krekel and others, 2004-2013
 """
-__version__ = '1.4.14'
+__version__ = '1.4.15.dev1'
 
 from py import _apipkg
 

py/_path/common.py

             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)
 
         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.dev1',
         url='http://pylib.readthedocs.org/',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

testing/path/test_local.py

         # 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)