| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
""" |
| 18 |
Upload packages |
| 19 |
~~~~~~~~~~~~~~~ |
| 20 |
|
| 21 |
""" |
| 22 |
|
| 23 |
import invoke as _invoke |
| 24 |
|
| 25 |
|
| 26 |
@_invoke.task(default=True) |
| 27 |
def source(ctx): |
| 28 |
"""Upload source package""" |
| 29 |
files = list(ctx.shell.files("dist", "*.tar.gz")) |
| 30 |
if len(files) != 1: |
| 31 |
ctx.fail("Not exactly one tarball found") |
| 32 |
|
| 33 |
cmd = "twine upload --repository-url %s --username %s %s" |
| 34 |
args = [ctx.pypi.repository, ctx.pypi.username, files[0]] |
| 35 |
|
| 36 |
with ctx.shell.root_dir(): |
| 37 |
ctx.run(ctx.c(cmd, *args), echo=True) |
| 38 |
|
| 39 |
|
| 40 |
@_invoke.task() |
| 41 |
def wheels(ctx): |
| 42 |
"""Upload wheels""" |
| 43 |
files = list(ctx.shell.files("dist", "*.whl")) |
| 44 |
if not files: |
| 45 |
ctx.fail("No wheel found") |
| 46 |
|
| 47 |
cmd = ( |
| 48 |
ctx.s("twine upload --repository-url") |
| 49 |
+ [ctx.pypi.repository, "--username", ctx.pypi.username] |
| 50 |
+ files |
| 51 |
) |
| 52 |
with ctx.shell.root_dir(): |
| 53 |
ctx.run(ctx.c(cmd), echo=True) |