forked from benmoran56/esper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.py
executable file
·54 lines (39 loc) · 1.21 KB
/
make.py
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
#!/usr/bin/env python
import os
import sys
import shlex
import shutil
from subprocess import call
HERE = os.path.dirname(os.path.abspath(__file__))
def clean():
"""Clean up all build & test artifacts."""
dirs = [os.path.join(HERE, 'dist'),
os.path.join(HERE, 'build'),
os.path.join(HERE, '_build'),
os.path.join(HERE, 'esper.egg-info'),
os.path.join(HERE, '.pytest_cache'),
os.path.join(HERE, '.mypy_cache')]
for d in dirs:
print(f' --> Deleting: {d}')
shutil.rmtree(d, ignore_errors=True)
def dist():
"""Create sdist and wheels, then upload to PyPi."""
call(shlex.split("flit publish"))
if __name__ == '__main__':
def _print_usage():
print('Usage: make.py <command>')
print(' where commands are:', ', '.join(avail_cmds))
print()
for name, cmd in avail_cmds.items():
print(name, '\t', cmd.__doc__)
avail_cmds = dict(clean=clean, dist=dist)
try:
command = avail_cmds[sys.argv[1]]
except IndexError:
_print_usage()
except KeyError:
print('Unknown command:', sys.argv[1])
print()
_print_usage()
else:
command()