aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2021-12-08 16:26:56 +0100
committerQuentin <quentin@deuxfleurs.fr>2021-12-08 16:26:56 +0100
commitabccfb88b8cc873b4f399d38a3151bbbe12c360d (patch)
treeed722a72449fbe23f7e5f3bc8058baf57d313c00
parenta13c37049a4a9c38ccc3acb0d78ed2717a29244c (diff)
downloadmknet-abccfb88b8cc873b4f399d38a3151bbbe12c360d.tar.gz
mknet-abccfb88b8cc873b4f399d38a3151bbbe12c360d.zip
Make mknet installable via pip
-rwxr-xr-xmknet (renamed from main.py)11
-rw-r--r--setup.py6
2 files changed, 12 insertions, 5 deletions
diff --git a/main.py b/mknet
index 456da52..8eb276a 100755
--- a/main.py
+++ b/mknet
@@ -345,11 +345,12 @@ def destroy():
if __name__ == "__main__":
if len(sys.argv) < 2:
- print("""Usage:
- mk-testnet create [config_path] # create a new network. config_path defailt to config.yml
- mk-testnet run-all <cmd> [args...] # run a command as each host. set the IP, NAME and ZONE environment variables
- mk-testnet run <name> [cmd [args...]] # run command in host named <name>. Use zonename:name if multiple zones hosts server with same name. If cmd is empty, run a shell
- mk-testnet destroy # destroy the current environment""")
+ progname = os.path.basename(sys.argv[0]) if len(sys.argv) > 0 else "mknet"
+ print(f"""Usage:
+ {progname} create [config_path] # create a new network. config_path defailt to config.yml
+ {progname} run-all <cmd> [args...] # run a command as each host. set the IP, NAME and ZONE environment variables
+ {progname} run <name> [cmd [args...]] # run command in host named <name>. Use zonename:name if multiple zones hosts server with same name. If cmd is empty, run a shell
+ {progname} destroy # destroy the current environment""")
exit()
cmd = sys.argv[1]
if cmd == "create":
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..fda29c5
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,6 @@
+from distutils.core import setup
+setup(name='mknet',
+ version='1.0',
+ scripts=['mknet'],
+ py_modules=['net'],
+ )