-
Notifications
You must be signed in to change notification settings - Fork 6
/
tasks.py
48 lines (39 loc) · 965 Bytes
/
tasks.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
# -*- coding: utf-8 -*-
import os
import sys
from invoke import task, run
docs_dir = 'docs'
build_dir = os.path.join(docs_dir, '_build')
@task
def test():
run('python setup.py test', pty=True)
@task
def clean():
run("rm -rf build")
run("rm -rf dist")
run("rm -rf YANS.egg-info")
clean_docs()
print("Cleaned up.")
@task
def clean_docs():
run("rm -rf %s" % build_dir)
@task
def browse_docs():
run("open %s" % os.path.join(build_dir, 'index.html'))
@task
def build_docs(clean=False, browse=False):
if clean:
clean_docs()
run("sphinx-build %s %s" % (docs_dir, build_dir), pty=True)
if browse:
browse_docs()
@task
def readme(browse=False):
run('rst2html.py README.rst > README.html')
@task
def publish(test=False):
"""Publish to the cheeseshop."""
if test:
run('python setup.py register -r test sdist upload -r test')
else:
run("python setup.py register sdist upload")