diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-07-13 23:14:46 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-07-13 23:14:46 (GMT) |
commit | 3f682adcf2c4507d90ac464bc8ec70b13f8b8412 (patch) | |
tree | 5e388ef68240f53777f561c8bbaf3dd18683fb69 /Lib | |
parent | 0a5d9a29bbc2dbbab5a408ba5f592ea47894a5b2 (diff) | |
download | cpython-3f682adcf2c4507d90ac464bc8ec70b13f8b8412.zip cpython-3f682adcf2c4507d90ac464bc8ec70b13f8b8412.tar.gz cpython-3f682adcf2c4507d90ac464bc8ec70b13f8b8412.tar.bz2 |
Partial port of r78919 from trunk: add subdir argument to the findfile helper
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/support.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index 1eb84eb..11bb168 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -387,12 +387,14 @@ if fp is not None: unlink(TESTFN) del fp -def findfile(file, here=__file__): +def findfile(file, here=__file__, subdir=None): """Try to find a file on sys.path and the working directory. If it is not found the argument passed to the function is returned (this does not necessarily signal failure; could still be the legitimate path).""" if os.path.isabs(file): return file + if subdir is not None: + file = os.path.join(subdir, file) path = sys.path path = [os.path.dirname(here)] + path for dn in path: |