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
d277d777
Commit
d277d777
authored
Jul 19, 2024
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add package hint
parent
ddf3f455
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
setup.py
setup.py
+13
-1
src/nemu/environ.py
src/nemu/environ.py
+6
-6
No files found.
setup.py
View file @
d277d777
...
...
@@ -9,6 +9,17 @@ setup(
version
=
'0.4'
,
description
=
'A lightweight network emulator embedded in a small '
'python library.'
,
long_description
=
open
(
'README.md'
).
read
(),
long_description_content_type
=
'text/markdown'
,
classifiers
=
[
'Development Status :: 4 - Beta'
,
'Environment :: Console'
,
'Intended Audience :: Developers'
,
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)'
,
'Operating System :: POSIX :: Linux'
,
'Programming Language :: Python :: 3'
,
'Topic :: System :: Networking'
,
],
author
=
'Martina Ferrari, Alina Quereilhac, Tom Niget'
,
author_email
=
'tina@tina.pm, aquereilhac@gmail.com, tom.niget@nexedi.com'
,
url
=
'https://lab.nexedi.com/nexedi/nemu3'
,
...
...
@@ -16,5 +27,6 @@ setup(
platforms
=
'Linux'
,
packages
=
[
'nemu'
],
install_requires
=
[
'unshare'
,
'six'
,
'attrs'
],
package_dir
=
{
''
:
'src'
}
package_dir
=
{
''
:
'src'
},
python_requires
=
'>=3.11'
,
)
src/nemu/environ.py
View file @
d277d777
...
...
@@ -58,18 +58,18 @@ def find_bin(name: str, extra_path: Optional[list[str]] = None) -> Optional[str]
return
None
def
find_bin_or_die
(
name
:
str
,
extra_path
:
Optional
[
list
[
str
]]
=
None
)
->
str
:
def
find_bin_or_die
(
name
:
str
,
hint
:
str
,
extra_path
:
Optional
[
list
[
str
]]
=
None
)
->
str
:
"""Try hard to find the location of needed programs; raise on failure."""
res
=
find_bin
(
name
,
extra_path
)
if
not
res
:
raise
RuntimeError
(
"Cannot find `%s', impossible to continue."
%
name
)
raise
RuntimeError
(
f"Cannot find `
{
name
}
', impossible to continue. Try installing the `
{
hint
}
` package."
)
return
res
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"
,
"iproute2"
)
TC_PATH
=
find_bin_or_die
(
"tc"
,
"iproute2"
)
BRCTL_PATH
=
find_bin_or_die
(
"brctl"
,
"bridge-utils"
)
SYSCTL_PATH
=
find_bin_or_die
(
"sysctl"
,
"procps"
)
# Optional tools
TCPDUMP_PATH
=
find_bin
(
"tcpdump"
)
...
...
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