-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
tasks.py
88 lines (72 loc) · 1.92 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
"""Read the Docs tasks."""
import os
from invoke import Collection, task
import common.dockerfiles.tasks
import common.tasks
ROOT_PATH = os.path.dirname(__file__)
namespace = Collection()
namespace.add_collection(
Collection(
common.tasks.setup_labels,
),
name="github",
)
namespace.add_collection(
Collection.from_module(
common.dockerfiles.tasks,
config={
"container_prefix": "community",
},
),
name="docker",
)
@task
def docs(ctx, regenerate_config=False, push=False):
"""Pull and push translations to Transifex for our docs."""
with ctx.cd(os.path.join(ROOT_PATH, "docs")):
# Update our translations
ctx.run("tx pull -a")
# Update resources
if regenerate_config:
os.remove(os.path.join(ROOT_PATH, "docs", ".tx", "config"))
ctx.run("sphinx-intl create-txconfig")
ctx.run(
"sphinx-intl update-txconfig-resources --transifex-project-name readthedocs-docs"
)
# Rebuild
ctx.run("sphinx-intl build")
ctx.run("make gettext")
# Push new ones
if push:
ctx.run("tx push -s")
namespace.add_collection(
Collection(
docs,
),
name="l10n",
)
@task(
help={
"package": "If specified, only update this package",
}
)
def update(ctx, package=None):
"""Update Python dependencies from requirements/*.txt."""
cmd = ["pip-compile", "--resolver=backtracking"]
if package:
cmd.extend(["--upgrade-package", package])
else:
cmd.append("--upgrade")
files = [
"requirements/pip",
"requirements/docker",
"requirements/testing",
"requirements/docs",
"requirements/deploy",
]
for file in files:
ctx.run(" ".join(cmd) + f" --output-file {file}.txt {file}.in")
namespace.add_collection(
Collection(update),
name="requirements",
)