Skip to content

Commit 26e62ea

Browse files
authored
Merge pull request #40 from pganssle/add_release_script
Add release script
2 parents 67cd893 + 81eaa65 commit 26e62ea

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ __pycache__
88
# Build detritus
99
build/
1010
dist/
11+
dists/
1112
.eggs
1213
*.egg-info/
1314

scripts/release.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! python3.7
2+
3+
import glob
4+
import subprocess
5+
6+
7+
def upload(release):
8+
if release:
9+
repository = ["-r", "pypi"]
10+
else:
11+
repository = ["--repository-url", "https://test.pypi.org/legacy/"]
12+
13+
dist_files = glob.glob("dists/*")
14+
args = ["twine", "upload"] + repository + dist_files
15+
16+
subprocess.check_call(args)
17+
18+
19+
if __name__ == "__main__":
20+
import argparse
21+
22+
parser = argparse.ArgumentParser(description="Make a release")
23+
parser.add_argument(
24+
"--release", action="store_true", help="Used to make a real release"
25+
)
26+
27+
args = parser.parse_args()
28+
29+
upload(args.release)

tox.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ deps = twine
5757
commands = python -m pep517.build --source --binary {toxinidir} \
5858
--out-dir {toxinidir}/dists
5959
twine check {toxinidir}/dists/*
60+
61+
[testenv:release]
62+
description = Make a pypi release
63+
basepython = python3.7
64+
passenv = *
65+
deps = twine
66+
commands = python scripts/release.py {posargs}

0 commit comments

Comments
 (0)