-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.py
37 lines (27 loc) · 1.03 KB
/
build.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
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
from os import system
from sys import stderr
from argparse import ArgumentParser
USAGE = "build.py [-h] ACTION"
parser = ArgumentParser(description="Manage building docs and release package",
usage=USAGE)
parser.add_argument('command', metavar='ACTION', type=str,
help='Build either "docs" or "release"')
opts = parser.parse_args()
if opts.command == "docs":
# Generate documentation.
system("sphinx-apidoc -o doc uptimerobot")
system("python setup.py build_sphinx")
print()
print("HTML documentation generated: build/sphinx/html/index.html")
elif opts.command == "release":
# Create source distribution.
result = system("python setup.py sdist")
if result == 0:
print()
print("Distribution package created in dist/")
else:
print('Invalid action (must be "docs" or "release")', file=stderr)
print("usage: %s" % USAGE, file=stderr)
exit(1)