This repository has been archived by the owner on Oct 7, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement test script to see if generated distributions can be installed * Add deployment script * Make sure old build artifacts are deleted before deploying
- Loading branch information
1 parent
255b575
commit 0430a0a
Showing
9 changed files
with
269 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,9 @@ attrs | |
# develop | ||
pdbpp | ||
|
||
# packaging | ||
twine | ||
|
||
# setup requires | ||
pytest-runner | ||
setuptools-scm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env python | ||
import argparse | ||
import os | ||
import shutil | ||
import subprocess | ||
|
||
from pypi2nix.version import pypi2nix_version | ||
|
||
|
||
def main(): | ||
set_up_environment() | ||
args = parse_args() | ||
pypi_name = get_pypi_name_from_args(args) | ||
remove_old_build_artifacts() | ||
deploy_to(pypi_name) | ||
|
||
|
||
def set_up_environment(): | ||
os.putenv("SOURCE_DATE_EPOCH", "315532800") | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser(description="Deploy pypi2nix to pypi") | ||
parser.add_argument("--production", action="store_true", default=False) | ||
return parser.parse_args() | ||
|
||
|
||
def get_pypi_name_from_args(args): | ||
return "pypi" if args.production else "test-pypi" | ||
|
||
|
||
def remove_old_build_artifacts(): | ||
shutil.rmtree("src/pypi2nix.egg-info", ignore_errors=True) | ||
|
||
|
||
def deploy_to(pypi_name): | ||
subprocess.run(["python", "setup.py", "sdist", "bdist_wheel"], check=True) | ||
distribution_paths = [ | ||
f"dist/pypi2nix-{pypi2nix_version}.tar.gz", | ||
f"dist/pypi2nix-{pypi2nix_version}-py3-none-any.whl", | ||
] | ||
subprocess.run( | ||
["twine", "upload", "-r", pypi_name] + distribution_paths, check=True | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.