generated from akashdhruv/myproject
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup
executable file
·66 lines (48 loc) · 1.63 KB
/
setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
"""Setup CLI script"""
import subprocess
import click
def get_options(with_instruments):
options = ""
if with_instruments:
options = options + "--with-instruments "
return options
@click.group(name="setup")
def setup():
"""Setup toolkit for Jobrunner"""
@setup.command(name="develop")
@click.option(
"--with-instruments",
is_flag=True,
help="Install additional modules for instruments",
)
def develop(with_instruments):
"""Development mode"""
options = get_options(with_instruments)
subprocess.run(f"python3 setup.py develop --user {options}", shell=True, check=True)
subprocess.run(
"cp jobrunner/scripts/jobrunner $HOME/.local/bin", shell=True, check=True
)
@setup.command(name="install")
@click.option(
"--with-instruments",
is_flag=True,
help="Install additional modules for instruments",
)
def install(with_instruments):
"""Installation command"""
options = get_options(with_instruments)
subprocess.run("python3 setup.py develop --user", shell=True, check=True)
subprocess.run("python3 setup.py build", shell=True, check=True)
subprocess.run(f"python3 setup.py install --user {options}", shell=True, check=True)
@setup.command(name="publish")
def publish():
"""Publish PyPi package"""
subprocess.run("python3 setup.py sdist", shell=True, check=True)
subprocess.run("twine upload --verbose dist/*", shell=True, check=True)
@setup.command(name="clean")
def clean():
"""Clean installation artifacts"""
subprocess.run("rm -rf *.egg-info build dist", shell=True, check=True)
if __name__ == "__main__":
setup()