forked from gammapy/gammapy-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.py
executable file
·38 lines (28 loc) · 893 Bytes
/
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
#!/usr/bin/env python
import subprocess
import click
# Global config
config = {}
def run(cmd):
print('Execute command: ', cmd)
if not config['dry']:
subprocess.call(cmd, shell=True)
@click.group()
@click.option('--dry', is_flag=True,
help='Dry run (just print, don\'t execute commands)')
def cli(dry):
"""Gammapy docs build & deploy tool"""
config['dry'] = dry
@cli.command('htmlcopy')
@click.argument('version')
def cli_htmlcopy(version):
"""Copy HTML from build to docs folder"""
cmd = f'cp -r build/{version}/gammapy/docs/_build/html/* docs/{version}/'
run(cmd)
if __name__ == '__main__':
cli()
"""
To check the repo size
(from https://stackoverflow.com/questions/8646517/see-the-size-of-a-github-repo-before-cloning-it)
curl https://api.github.com/repos/gammapy/gammapy-docs 2> /dev/null | grep size | tr -dc '[:digit:]'
"""