rtool: remove support for source distributions

This commit is contained in:
Maximilian Hils 2016-02-16 00:39:07 +01:00
parent 615e4ec163
commit df92228b93

View File

@ -102,13 +102,6 @@ def archive_name(project):
) )
def sdist_name(project):
return "{project}-{version}.tar.gz".format(
project=project,
version=get_version()
)
def wheel_name(project): def wheel_name(project):
return "{project}-{version}-{py_version}-none-any.whl".format( return "{project}-{version}-{py_version}-none-any.whl".format(
project=project, project=project,
@ -186,21 +179,20 @@ def set_version(version):
f.write(new_content) f.write(new_content)
@cli.command("sdist") @cli.command("wheels")
def sdist(): def wheels():
""" """
Build a source distribution Build wheels
""" """
with empty_pythonpath(): with empty_pythonpath():
print("Building release...") print("Building release...")
if os.path.exists(DIST_DIR): if os.path.exists(DIST_DIR):
shutil.rmtree(DIST_DIR) shutil.rmtree(DIST_DIR)
for project, conf in projects.items(): for project, conf in projects.items():
print("Creating %s source distribution..." % project) print("Creating wheel for %s ..." % project)
subprocess.check_call( subprocess.check_call(
[ [
"python", "./setup.py", "-q", "python", "./setup.py", "-q",
"sdist", "--dist-dir", DIST_DIR, "--formats=gztar",
"bdist_wheel", "--dist-dir", DIST_DIR, "bdist_wheel", "--dist-dir", DIST_DIR,
], ],
cwd=conf["dir"] cwd=conf["dir"]
@ -214,7 +206,7 @@ def sdist():
with chdir(DIST_DIR): with chdir(DIST_DIR):
for project, conf in projects.items(): for project, conf in projects.items():
print("Installing %s..." % project) print("Installing %s..." % project)
subprocess.check_call([VENV_PIP, "install", "-q", sdist_name(project)]) subprocess.check_call([VENV_PIP, "install", "-q", wheel_name(project)])
print("Running binaries...") print("Running binaries...")
for project, conf in projects.items(): for project, conf in projects.items():
@ -228,10 +220,10 @@ def sdist():
@cli.command("bdist") @cli.command("bdist")
@click.option("--use-existing-sdist/--no-use-existing-sdist", default=False) @click.option("--use-existing-wheels/--no-use-existing-wheels", default=False)
@click.argument("pyinstaller_version", envvar="PYINSTALLER_VERSION", default="PyInstaller~=3.1.1") @click.argument("pyinstaller_version", envvar="PYINSTALLER_VERSION", default="PyInstaller~=3.1.1")
@click.pass_context @click.pass_context
def bdist(ctx, use_existing_sdist, pyinstaller_version): def bdist(ctx, use_existing_wheels, pyinstaller_version):
""" """
Build a binary distribution Build a binary distribution
""" """
@ -240,8 +232,8 @@ def bdist(ctx, use_existing_sdist, pyinstaller_version):
if os.path.exists(PYINSTALLER_DIST): if os.path.exists(PYINSTALLER_DIST):
shutil.rmtree(PYINSTALLER_DIST) shutil.rmtree(PYINSTALLER_DIST)
if not use_existing_sdist: if not use_existing_wheels:
ctx.invoke(sdist) ctx.invoke(wheels)
print("Installing PyInstaller...") print("Installing PyInstaller...")
subprocess.check_call([VENV_PIP, "install", "-q", pyinstaller_version]) subprocess.check_call([VENV_PIP, "install", "-q", pyinstaller_version])
@ -280,27 +272,20 @@ def bdist(ctx, use_existing_sdist, pyinstaller_version):
@click.option('--username', prompt=True) @click.option('--username', prompt=True)
@click.password_option(confirmation_prompt=False) @click.password_option(confirmation_prompt=False)
@click.option('--repository', default="pypi") @click.option('--repository', default="pypi")
@click.option("--sdist/--no-sdist", default=True) def upload_release(username, password, repository):
@click.option("--wheel/--no-wheel", default=True)
def upload_release(username, password, repository, sdist, wheel):
""" """
Upload source distributions to PyPI Upload wheels to PyPI
""" """
for project in projects.keys(): for project in projects.keys():
files = [] filename = wheel_name(project)
if sdist: print("Uploading {} to {}...".format(filename, repository))
files.append(sdist_name(project))
if wheel:
files.append(wheel_name(project))
for f in files:
print("Uploading {} to {}...".format(f, repository))
subprocess.check_call([ subprocess.check_call([
"twine", "twine",
"upload", "upload",
"-u", username, "-u", username,
"-p", password, "-p", password,
"-r", repository, "-r", repository,
join(DIST_DIR, f) join(DIST_DIR, filename)
]) ])
@ -310,10 +295,9 @@ def upload_release(username, password, repository, sdist, wheel):
@click.option("--user", envvar="SNAPSHOT_USER", prompt=True) @click.option("--user", envvar="SNAPSHOT_USER", prompt=True)
@click.option("--private-key", default=join(RELEASE_DIR, "rtool.pem")) @click.option("--private-key", default=join(RELEASE_DIR, "rtool.pem"))
@click.option("--private-key-password", envvar="SNAPSHOT_PASS", prompt=True, hide_input=True) @click.option("--private-key-password", envvar="SNAPSHOT_PASS", prompt=True, hide_input=True)
@click.option("--sdist/--no-sdist", default=False)
@click.option("--wheel/--no-wheel", default=False) @click.option("--wheel/--no-wheel", default=False)
@click.option("--bdist/--no-bdist", default=False) @click.option("--bdist/--no-bdist", default=False)
def upload_snapshot(host, port, user, private_key, private_key_password, sdist, wheel, bdist): def upload_snapshot(host, port, user, private_key, private_key_password, wheel, bdist):
""" """
Upload snapshot to snapshot server Upload snapshot to snapshot server
""" """
@ -327,8 +311,6 @@ def upload_snapshot(host, port, user, private_key, private_key_password, sdist,
sftp.makedirs(dir_name) sftp.makedirs(dir_name)
with sftp.cd(dir_name): with sftp.cd(dir_name):
files = [] files = []
if sdist:
files.append(sdist_name(project))
if wheel: if wheel:
files.append(wheel_name(project)) files.append(wheel_name(project))
if bdist and conf["tools"]: if bdist and conf["tools"]: