-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
69 lines (53 loc) · 1.64 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Brian Cherinka
# @Date: 2017-09-27
# @Filename: tasks.py
# @License: BSD 3-Clause
# @Copyright: Brian Cherinka
from __future__ import print_function, division, absolute_import, unicode_literals
import os
from invoke import Collection, task
# This file contains tasks that can be easily run from the shell terminal using the Invoke
# python package. If you do not have invoke, install it with pip install
# To list the tasks available, type invoke --list from the top-level repo directory
@task
def clean_docs(ctx):
''' Cleans up the Sphinx docs '''
print('Cleaning the docs')
ctx.run("rm -rf docs/sphinx/_build")
@task(clean_docs)
def build_docs(ctx):
''' Builds the Sphinx docs '''
print('Building the docs')
os.chdir('docs/sphinx')
ctx.run("make html")
@task(build_docs)
def show_docs(ctx):
"""Shows the Sphinx docs"""
print('Showing the docs')
os.chdir('_build/html')
ctx.run('open ./index.html')
@task
def clean(ctx):
''' Cleans up the crap before a Pip build '''
print('Cleaning')
ctx.run("rm -rf htmlcov")
ctx.run("rm -rf build")
ctx.run("rm -rf dist")
@task(clean)
def deploy(ctx):
''' Deploy the project to pypi '''
print('Deploying to Pypi!')
ctx.run("python setup.py sdist bdist_wheel --universal")
ctx.run("twine upload dist/*")
# create a collection of tasks
ns = Collection(clean, deploy)
# create a sub-collection for the doc tasks
docs = Collection('docs')
docs.add_task(build_docs, 'build')
docs.add_task(clean_docs, 'clean')
docs.add_task(show_docs, 'show')
ns.add_collection(docs)