def upload(ctx, release, rebuild):
    """ Uploads distribuition files to pypi or pypitest. """
    dist_path = Path(DIST_PATH)
    if rebuild is False:
        if not dist_path.exists() or not list(dist_path.glob('*')):
            print("No distribution files found. Please run 'build' command first")
            return
    else:
        ctx.invoke(build, force=True)

    if release:
        args = ['twine', 'upload', 'dist/*']
    else:
        repository = 'https://test.pypi.org/legacy/'
        args = ['twine', 'upload', '--repository-url', repository, 'dist/*']

    env = os.environ.copy()

    p = subprocess.Popen(args, env=env)
    p.wait()
def upload ( ctx , release , rebuild ) : dist_path = Path ( DIST_PATH ) if rebuild is False : if not dist_path . exists ( ) or not list ( dist_path . glob ( '*' ) ) : print ( "No distribution files found. Please run 'build' command first" ) return else : ctx . invoke ( build , force = True ) if release : args = [ 'twine' , 'upload' , 'dist/*' ] else : repository = 'https://test.pypi.org/legacy/' args = [ 'twine' , 'upload' , '--repository-url' , repository , 'dist/*' ] env = os . environ . copy ( ) p = subprocess . Popen ( args , env = env ) p . wait ( )
Uploads distribuition files to pypi or pypitest.