Commit d277d777 authored by Tom Niget's avatar Tom Niget

Add package hint

parent ddf3f455
......@@ -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',
)
......@@ -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")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment