Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
117f91fa
Commit
117f91fa
authored
Aug 11, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow user-specified search paths in find_bin
parent
ce813aaf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
src/netns/environ.py
src/netns/environ.py
+5
-2
No files found.
src/netns/environ.py
View file @
117f91fa
...
@@ -6,13 +6,16 @@ __all__ = ["ip_path", "tc_path", "brctl_path", "sysctl_path", "hz"]
...
@@ -6,13 +6,16 @@ __all__ = ["ip_path", "tc_path", "brctl_path", "sysctl_path", "hz"]
__all__
+=
[
"tcpdump_path"
,
"netperf_path"
]
__all__
+=
[
"tcpdump_path"
,
"netperf_path"
]
__all__
+=
[
"execute"
,
"backticks"
]
__all__
+=
[
"execute"
,
"backticks"
]
def
find_bin
(
name
):
def
find_bin
(
name
,
extra_path
=
None
):
search
=
[]
search
=
[]
if
"PATH"
in
os
.
environ
:
if
"PATH"
in
os
.
environ
:
search
+=
os
.
environ
[
"PATH"
].
split
(
":"
)
search
+=
os
.
environ
[
"PATH"
].
split
(
":"
)
for
pref
in
(
"/"
,
"/usr/"
,
"/usr/local/"
):
for
pref
in
(
"/"
,
"/usr/"
,
"/usr/local/"
):
for
d
in
(
"bin/"
,
"sbin/"
):
for
d
in
(
"bin/"
,
"sbin/"
):
search
.
append
(
pref
+
d
)
search
.
append
(
pref
+
d
)
if
extra_path
:
search
+=
extra_path
for
d
in
search
:
for
d
in
search
:
try
:
try
:
os
.
stat
(
d
+
name
)
os
.
stat
(
d
+
name
)
...
@@ -22,7 +25,7 @@ def find_bin(name):
...
@@ -22,7 +25,7 @@ def find_bin(name):
raise
raise
return
None
return
None
def
find_bin_or_die
(
name
):
def
find_bin_or_die
(
name
,
extra_path
=
None
):
r
=
find_bin
(
name
)
r
=
find_bin
(
name
)
if
not
r
:
if
not
r
:
raise
RuntimeError
((
"Cannot find `%s' command, impossible to "
+
raise
RuntimeError
((
"Cannot find `%s' command, impossible to "
+
...
...
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