|
16 | 16 | Collection(
|
17 | 17 | common.tasks.setup_labels,
|
18 | 18 | ),
|
19 |
| - name='github', |
| 19 | + name="github", |
20 | 20 | )
|
21 | 21 |
|
22 | 22 | namespace.add_collection(
|
23 | 23 | Collection.from_module(
|
24 | 24 | common.dockerfiles.tasks,
|
25 | 25 | config={
|
26 |
| - 'container_prefix': 'community', |
| 26 | + "container_prefix": "community", |
27 | 27 | },
|
28 | 28 | ),
|
29 |
| - name='docker', |
| 29 | + name="docker", |
30 | 30 | )
|
31 | 31 |
|
| 32 | + |
32 | 33 | @task
|
33 | 34 | def docs(ctx, regenerate_config=False, push=False):
|
34 |
| - """Pull and push translations to Transifex for our docs""" |
35 |
| - with ctx.cd(os.path.join(ROOT_PATH, 'docs')): |
| 35 | + """Pull and push translations to Transifex for our docs.""" |
| 36 | + with ctx.cd(os.path.join(ROOT_PATH, "docs")): |
36 | 37 | # Update our translations
|
37 |
| - ctx.run('tx pull -a') |
| 38 | + ctx.run("tx pull -a") |
38 | 39 | # Update resources
|
39 | 40 | if regenerate_config:
|
40 |
| - os.remove(os.path.join(ROOT_PATH, 'docs', '.tx', 'config')) |
41 |
| - ctx.run('sphinx-intl create-txconfig') |
42 |
| - ctx.run('sphinx-intl update-txconfig-resources --transifex-project-name readthedocs-docs') |
| 41 | + os.remove(os.path.join(ROOT_PATH, "docs", ".tx", "config")) |
| 42 | + ctx.run("sphinx-intl create-txconfig") |
| 43 | + ctx.run( |
| 44 | + "sphinx-intl update-txconfig-resources --transifex-project-name readthedocs-docs" |
| 45 | + ) |
43 | 46 | # Rebuild
|
44 |
| - ctx.run('sphinx-intl build') |
45 |
| - ctx.run('make gettext') |
| 47 | + ctx.run("sphinx-intl build") |
| 48 | + ctx.run("make gettext") |
46 | 49 | # Push new ones
|
47 | 50 | if push:
|
48 |
| - ctx.run('tx push -s') |
| 51 | + ctx.run("tx push -s") |
49 | 52 |
|
50 | 53 |
|
51 | 54 | namespace.add_collection(
|
52 | 55 | Collection(
|
53 | 56 | docs,
|
54 | 57 | ),
|
55 |
| - name='l10n', |
| 58 | + name="l10n", |
| 59 | +) |
| 60 | + |
| 61 | + |
| 62 | +@task( |
| 63 | + help={ |
| 64 | + "package": "If specified, only update this package", |
| 65 | + } |
| 66 | +) |
| 67 | +def update(ctx, package=None): |
| 68 | + """Update Python dependencies from requirements/*.txt.""" |
| 69 | + cmd = ["pip-compile", "--resolver=backtracking"] |
| 70 | + if package: |
| 71 | + cmd.extend(["--upgrade-package", package]) |
| 72 | + else: |
| 73 | + cmd.append("--upgrade") |
| 74 | + files = [ |
| 75 | + "requirements/pip", |
| 76 | + "requirements/docker", |
| 77 | + "requirements/testing", |
| 78 | + "requirements/docs", |
| 79 | + "requirements/deploy", |
| 80 | + ] |
| 81 | + for file in files: |
| 82 | + ctx.run(" ".join(cmd) + f" --output-file {file}.txt {file}.in") |
| 83 | + |
| 84 | + |
| 85 | +namespace.add_collection( |
| 86 | + Collection(update), |
| 87 | + name="requirements", |
56 | 88 | )
|
0 commit comments