File: upload.py

package info (click to toggle)
python-rjsmin 1.2.0%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,000 kB
  • sloc: javascript: 8,503; python: 2,847; ansic: 821; sh: 63; makefile: 19
file content (39 lines) | stat: -rw-r--r-- 967 bytes parent folder | download | duplicates (3)
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
# -*- encoding: ascii -*-
"""
Uploading
~~~~~~~~~

"""

import invoke as _invoke


@_invoke.task(default=True)
def source(ctx):
    """ Upload source package """
    with ctx.shell.root_dir():
        files = list(ctx.shell.files('dist', '*.tar.gz'))
        if len(files) != 1:
            ctx.fail("Not exactly one tarball found")

        ctx.run(ctx.c('''
            twine upload
            --repository-url %s
            --username %s
            %s
        ''', ctx.pypi.repository, ctx.pypi.username, files[0]), echo=True)


@_invoke.task()
def wheels(ctx):
    """ Upload wheels """
    with ctx.shell.root_dir():
        files = list(ctx.shell.files('wheel/dist', '*manylinux*.whl'))
        if not files:
            ctx.fail("No tarball found ")

        ctx.run(ctx.c(
            ''' twine upload --repository-url %s --username %s '''
            + ' %s ' * len(files),
            ctx.pypi.repository, ctx.pypi.username, *files
        ), echo=True)