Make mknet installable via pip

This commit is contained in:
Quentin 2021-12-08 16:26:56 +01:00
parent a13c37049a
commit abccfb88b8
2 changed files with 12 additions and 5 deletions

View file

@ -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":

6
setup.py Normal file
View file

@ -0,0 +1,6 @@
from distutils.core import setup
setup(name='mknet',
version='1.0',
scripts=['mknet'],
py_modules=['net'],
)