forked from sloria/TextBlob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
51 lines (40 loc) · 1005 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
49
50
51
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import webbrowser
from invoke import task
docs_dir = 'docs'
build_dir = os.path.join(docs_dir, '_build')
@task
def test(ctx):
ctx.run("python run_tests.py", pty=True)
@task
def clean(ctx):
ctx.run("rm -rf build")
ctx.run("rm -rf dist")
ctx.run("rm -rf textblob.egg-info")
clean_docs(ctx)
print("Cleaned up.")
@task
def clean_docs(ctx):
ctx.run("rm -rf %s" % build_dir)
@task
def browse_docs(ctx):
path = os.path.join(build_dir, 'index.html')
webbrowser.open_new_tab(path)
@task
def docs(ctx, clean=False, browse=False):
if clean:
clean_docs(ctx)
ctx.run("sphinx-build %s %s" % (docs_dir, build_dir), pty=True)
if browse:
browse_docs(ctx)
@task
def readme(ctx, browse=False):
ctx.run("rst2html.py README.rst > README.html", pty=True)
if browse:
webbrowser.open_new_tab('README.html')
@task
def doctest(ctx):
os.chdir(docs_dir)
ctx.run("make doctest")