diff options
Diffstat (limited to 'tools/distrib/python/submit.py')
-rwxr-xr-x | tools/distrib/python/submit.py | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/tools/distrib/python/submit.py b/tools/distrib/python/submit.py index 92eab5ad65..aff71b5eb1 100755 --- a/tools/distrib/python/submit.py +++ b/tools/distrib/python/submit.py @@ -21,43 +21,52 @@ import subprocess parser = argparse.ArgumentParser( description='Submit the package to a PyPI repository.') parser.add_argument( - '--repository', '-r', metavar='r', type=str, default='pypi', + '--repository', + '-r', + metavar='r', + type=str, + default='pypi', help='The repository to push the package to. ' - 'Ensure the value appears in your .pypirc file. ' - 'Defaults to "pypi".' -) + 'Ensure the value appears in your .pypirc file. ' + 'Defaults to "pypi".') parser.add_argument( - '--identity', '-i', metavar='i', type=str, - help='GPG identity to sign the files with.' -) + '--identity', + '-i', + metavar='i', + type=str, + help='GPG identity to sign the files with.') parser.add_argument( - '--username', '-u', metavar='u', type=str, + '--username', + '-u', + metavar='u', + type=str, help='Username to authenticate with the repository. Not needed if you have ' - 'configured your .pypirc to include your username.' -) + 'configured your .pypirc to include your username.') parser.add_argument( - '--password', '-p', metavar='p', type=str, + '--password', + '-p', + metavar='p', + type=str, help='Password to authenticate with the repository. Not needed if you have ' - 'configured your .pypirc to include your password.' -) + 'configured your .pypirc to include your password.') parser.add_argument( - '--bdist', '-b', action='store_true', - help='Generate a binary distribution (wheel) for the current OS.' -) + '--bdist', + '-b', + action='store_true', + help='Generate a binary distribution (wheel) for the current OS.') parser.add_argument( - '--dist-args', type=str, - help='Additional arguments to pass to the *dist setup.py command.' -) + '--dist-args', + type=str, + help='Additional arguments to pass to the *dist setup.py command.') args = parser.parse_args() # Move to the root directory of Python GRPC. -pkgdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), - '../../../') +pkgdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../') # Remove previous distributions; they somehow confuse twine. try: - shutil.rmtree(os.path.join(pkgdir, 'dist/')) + shutil.rmtree(os.path.join(pkgdir, 'dist/')) except: - pass + pass # Build the Cython C files build_env = os.environ.copy() @@ -67,20 +76,20 @@ subprocess.call(cmd, cwd=pkgdir, env=build_env) # Make the push. if args.bdist: - cmd = ['python', 'setup.py', 'bdist_wheel'] + cmd = ['python', 'setup.py', 'bdist_wheel'] else: - cmd = ['python', 'setup.py', 'sdist'] + cmd = ['python', 'setup.py', 'sdist'] if args.dist_args: - cmd += args.dist_args.split() + cmd += args.dist_args.split() subprocess.call(cmd, cwd=pkgdir) cmd = ['twine', 'upload', '-r', args.repository] if args.identity is not None: - cmd.extend(['-i', args.identity]) + cmd.extend(['-i', args.identity]) if args.username is not None: - cmd.extend(['-u', args.username]) + cmd.extend(['-u', args.username]) if args.password is not None: - cmd.extend(['-p', args.password]) + cmd.extend(['-p', args.password]) cmd.append('dist/*') subprocess.call(cmd, cwd=pkgdir) |