[py-svn] r10971 - py/dist/py/path/local
hpk at codespeak.net
hpk at codespeak.net
Thu Apr 21 13:09:16 CEST 2005
Author: hpk
Date: Thu Apr 21 13:09:16 2005
New Revision: 10971
Modified:
py/dist/py/path/local/local.py
Log:
if a path given to sysfind() is already absolute
don't do any path lookups
Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py (original)
+++ py/dist/py/path/local/local.py Thu Apr 21 13:09:16 2005
@@ -476,20 +476,26 @@
Note: This is probably not working on plain win32 systems
but may work on cygwin.
"""
- if py.std.sys.platform == 'win32':
- paths = py.std.os.environ['Path'].split(';')
- tryadd = '', '.exe', '.com', '.bat' # XXX add more?
+ if os.path.isabs(name):
+ p = py.path.local(name)
+ if p.check(file=1):
+ return p
else:
- paths = py.std.os.environ['PATH'].split(':')
- tryadd = ('',)
- for x in paths:
- for addext in tryadd:
- p = py.path.local(x).join(name, abs=True) + addext
- if p.check(file=1):
- if checker:
- if not checker(p):
- continue
- return p
+ if py.std.sys.platform == 'win32':
+ paths = py.std.os.environ['Path'].split(';')
+ tryadd = '', '.exe', '.com', '.bat' # XXX add more?
+ else:
+ paths = py.std.os.environ['PATH'].split(':')
+ tryadd = ('',)
+
+ for x in paths:
+ for addext in tryadd:
+ p = py.path.local(x).join(name, abs=True) + addext
+ if p.check(file=1):
+ if checker:
+ if not checker(p):
+ continue
+ return p
raise py.error.ENOENT(name)
sysfind = classmethod(sysfind)
#"""
More information about the pytest-commit
mailing list