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
ce813aaf
Commit
ce813aaf
authored
Aug 11, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make find_bin search in system PATH first. Export find_bin_*
parent
81747f7d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
src/netns/environ.py
src/netns/environ.py
+16
-11
No files found.
src/netns/environ.py
View file @
ce813aaf
...
...
@@ -6,32 +6,37 @@ __all__ = ["ip_path", "tc_path", "brctl_path", "sysctl_path", "hz"]
__all__
+=
[
"tcpdump_path"
,
"netperf_path"
]
__all__
+=
[
"execute"
,
"backticks"
]
def
_find_bin
(
name
):
def
find_bin
(
name
):
search
=
[]
if
"PATH"
in
os
.
environ
:
search
+=
os
.
environ
[
"PATH"
].
split
(
":"
)
for
pref
in
(
"/"
,
"/usr/"
,
"/usr/local/"
):
for
d
in
(
"bin/"
,
"sbin/"
):
search
.
append
(
pref
+
d
)
for
d
in
search
:
try
:
os
.
stat
(
pref
+
d
+
name
)
return
pref
+
d
+
name
os
.
stat
(
d
+
name
)
return
d
+
name
except
OSError
,
e
:
if
e
.
errno
!=
os
.
errno
.
ENOENT
:
raise
return
None
def
_
find_bin_or_die
(
name
):
r
=
_
find_bin
(
name
)
def
find_bin_or_die
(
name
):
r
=
find_bin
(
name
)
if
not
r
:
raise
RuntimeError
((
"Cannot find `%s' command, impossible to "
+
"continue."
)
%
name
)
return
r
ip_path
=
_
find_bin_or_die
(
"ip"
)
tc_path
=
_
find_bin_or_die
(
"tc"
)
brctl_path
=
_
find_bin_or_die
(
"brctl"
)
sysctl_path
=
_
find_bin_or_die
(
"sysctl"
)
ip_path
=
find_bin_or_die
(
"ip"
)
tc_path
=
find_bin_or_die
(
"tc"
)
brctl_path
=
find_bin_or_die
(
"brctl"
)
sysctl_path
=
find_bin_or_die
(
"sysctl"
)
# Optional tools
tcpdump_path
=
_
find_bin
(
"tcpdump"
)
netperf_path
=
_
find_bin
(
"netperf"
)
tcpdump_path
=
find_bin
(
"tcpdump"
)
netperf_path
=
find_bin
(
"netperf"
)
# Seems this is completely bogus. At least, we can assume that the internal HZ
# is bigger than this.
...
...
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