Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f682adc
Commit
3f682adc
authored
Jul 13, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partial port of r78919 from trunk: add subdir argument to the findfile helper
parent
0a5d9a29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
Lib/test/support.py
Lib/test/support.py
+3
-1
No files found.
Lib/test/support.py
View file @
3f682adc
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment