Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare 0.3.1 #38

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# How to Make a Release
# ---------------------
#
# This file answers the question "how to make a release" hopefully
# better than a document does (only meejah and warner may currently do
# the "upload to PyPI" part anyway)
#

default:
echo "see Makefile"

release-clean:
@echo "Cleanup stale release: " `python newest-version.py`
-rm NEWS.md.asc
-rm dist/magic-wormhole-transit-relay-`python newest-version.py`.tar.gz*
-rm dist/magic_wormhole_transit_relay-`python newest-version.py`-py3-none-any.whl*
git tag -d `python newest-version.py`

release:
@echo "Is checkout clean?"
git diff-files --quiet
git diff-index --quiet --cached HEAD --

@echo "Install required build software"
python3 -m pip install --editable .[build]

@echo "Test README"
python3 setup.py check -s

@echo "Is GPG Agent running, and has key?"
gpg --pinentry=loopback -u [email protected] --armor --sign NEWS.md

@echo "Bump version and create tag"
python3 update-version.py
# python3 update-version.py --patch # for bugfix release

@echo "Build and sign wheel"
python3 setup.py bdist_wheel
gpg --pinentry=loopback -u [email protected] --armor --detach-sign dist/magic_wormhole_transit_relay-`git describe --abbrev=0`-py3-none-any.whl
ls dist/*`git describe --abbrev=0`*

@echo "Build and sign source-dist"
python3 setup.py sdist
gpg --pinentry=loopback -u [email protected] --armor --detach-sign dist/magic-wormhole-transit-relay-`git describe --abbrev=0`.tar.gz
ls dist/*`git describe --abbrev=0`*

release-test:
gpg --verify dist/magic-wormhole-transit-relay-`git describe --abbrev=0`.tar.gz.asc
gpg --verify dist/magic_wormhole_transit_relay-`git describe --abbrev=0`-py3-none-any.whl.asc
python -m venv testmf_venv
testmf_venv/bin/pip install --upgrade pip
testmf_venv/bin/pip install dist/magic_wormhole_transit_relay-`git describe --abbrev=0`-py3-none-any.whl
testmf_venv/bin/twistd transitrelay --version
testmf_venv/bin/pip uninstall -y magic-wormhole-transit-relay
testmf_venv/bin/pip install dist/magic-wormhole-transit-relay-`git describe --abbrev=0`.tar.gz
testmf_venv/bin/twistd transitrelay --version
rm -rf testmf_venv

release-upload:
twine upload --username __token__ --password `cat PRIVATE-release-token` dist/magic_wormhole_transit_relay-`git describe --abbrev=0`-py3-none-any.whl dist/magic_wormhole_transit_relay-`git describe --abbrev=0`-py3-none-any.whl.asc dist/magic-wormhole-transit-relay-`git describe --abbrev=0`.tar.gz dist/magic-wormhole-transit-relay-`git describe --abbrev=0`.tar.gz.asc
mv dist/*-`git describe --abbrev=0`.tar.gz.asc signatures/
mv dist/*-`git describe --abbrev=0`-py3-none-any.whl.asc signatures/
git add signatures/magic-wormhole-transit-relay-`git describe --abbrev=0`.tar.gz.asc
git add signatures/magic_wormhole_transit_relay-`git describe --abbrev=0`-py3-none-any.whl.asc
git commit -m "signatures for release"
git push origin-push `git describe --abbrev=0`
26 changes: 26 additions & 0 deletions newest-version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# print out the most-recent version
#

from dulwich.repo import Repo
from dulwich.porcelain import tag_list

from twisted.internet.task import react
from twisted.internet.defer import ensureDeferred


def existing_tags(git):
versions = [
tuple(map(int, v.decode("utf8").split(".")))
for v in tag_list(git)
]
return versions


async def main(reactor):
git = Repo(".")
print("{}.{}.{}".format(*sorted(existing_tags(git))[-1]))


if __name__ == "__main__":
react(lambda r: ensureDeferred(main(r)))
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[wheel]
universal = 1

[versioneer]
VCS = git
versionfile_source = src/wormhole_transit_relay/_version.py
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
extras_require={
':sys_platform=="win32"': ["pypiwin32"],
"dev": ["mock", "tox", "pyflakes"],
"build": ["twine", "dulwich", "readme_renderer", "gpg", "wheel"],
},
test_suite="wormhole_transit_relay.test",
cmdclass=commands,
Expand Down
11 changes: 11 additions & 0 deletions signatures/magic-wormhole-transit-relay-0.3.0.tar.gz.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----

iQFFBAABCgAvFiEEnVor1WiOy4id680/wmAoAxKAaacFAmbCfFIRHG1lZWphaEBt
ZWVqYWguY2EACgkQwmAoAxKAaaf9Zwf9Hd9Ziw8wCrMoAIOUGqzkj+c6z1q6KLSW
XQvOgbr2b4ktNow4FixGAP3czHD2tfckz82V/ZQKj+8fZtLZvt0bAolRFNnGf19Q
VQ6wMUrgrt1jkBPTWFDvDO+9biYkNe4FGhtXgIC09qZNgRf6afedGuSIHwVktmXM
oNpH+S/7YAjuwPA5dAsfaGa6oxLa3ZXlt2xUXagT4VlHGGKvKY1O8j6zMXC808U3
8ZndIwwJB1CYMF8+XrThZGsjRPzFFw4U7+gYY75d4MyLTv1osrWKfpOm/Jxsikx6
raEVBCUuityo46qdkA8BEt1iBD5Z05NrhLdqM4Z1a+dAZh1XF8iq6w==
=w71/
-----END PGP SIGNATURE-----
11 changes: 11 additions & 0 deletions signatures/magic-wormhole-transit-relay-0.3.1.tar.gz.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----

iQFFBAABCgAvFiEEnVor1WiOy4id680/wmAoAxKAaacFAmbCkgIRHG1lZWphaEBt
ZWVqYWguY2EACgkQwmAoAxKAaaeUbwf8Dt1gODsiqQlPaKfhH2eVVAWka9bGmdom
YfH0pkammfIF7d56n79MtKHNXweujnqCTH/KA0lcG27KpxbIZnDLoLjpe5z1dP8O
1oBSzHH9Q5GxEToHK4QzsKT5s0SvbmDTaEt4wWvw9UH+/SGD6GHswhCNDXC0UgWX
2n9DK6vVvkMc90mcQxcp3GB6r5MhZHBn+Fb0aPdXyZwvKIjL79FUlh1XszUVrR9S
3UjWPbmcU7NGpUcjZbu+mBHX6AMSrr0RFumsWwlIakplpBA/ObZr/YNW3V9PCG3u
qVtO16uNDfuKey3D3y1eCqxte0UkSd1dnAAhbMdKX4sPxamTTDRIJw==
=Esix
-----END PGP SIGNATURE-----
11 changes: 11 additions & 0 deletions signatures/magic_wormhole_transit_relay-0.3.0-py3-none-any.whl.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----

iQFFBAABCgAvFiEEnVor1WiOy4id680/wmAoAxKAaacFAmbCfFIRHG1lZWphaEBt
ZWVqYWguY2EACgkQwmAoAxKAaafm1wf/dqAzYiqts9ccKoapZhZAPHWiSABDOu5G
I13OBYmw0giCJm2o3H8NyN4Xr3/vQIF/jZn22CECEDWRq1TXUGcTHjQGTiaozE2o
lPgiKcEm3LN0F2oTR1BlbnPY/27ue6KcKn8ihJXPhb5RiWemiOfxGIZaV64NJNWo
843JXROEMBgqc1STt1UjJ5Qd4l+xajzRXXj3uucTNAalCw3LZB/iumj93RWCzc+B
uf3O75aAuGgrK511AMD/3duoGrpllP95hEQVXfzLLpnujt/HTtSWFMAoNK3lmtrR
+x0cozg5lD2xHhIPpoINcsE5bgJoVzk4U5fPMnG0w64m9UH6Clcm/w==
=ygrs
-----END PGP SIGNATURE-----
11 changes: 11 additions & 0 deletions signatures/magic_wormhole_transit_relay-0.3.1-py3-none-any.whl.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----

iQFFBAABCgAvFiEEnVor1WiOy4id680/wmAoAxKAaacFAmbCkgIRHG1lZWphaEBt
ZWVqYWguY2EACgkQwmAoAxKAaaczdgf/XzUZOD9zW9bANRfrccsVCA2VVd9H2mZn
rwgVP9mJCtTgfEY9S4szrLcWTbwBjCWq0OTtkwrsglUjApjbvs+bfoLc4xxkv3pf
3Qm+sYDs8Vj3Z6qmf2/zlOmC4DLVCmHCXfoy3EHtrRsew2vrdIdGq7QuwLBwaDO6
BLnqULL0j+uj5m+T0W3Dp8PePJ8pktc/5sYZyX9C5p5hY6F1qN0FbGtwVvrwBtoM
SIoxROvDTf6xgcPel7jlsxneYhoI5JO5EB5kj61fwSqdgGIQ4T6b2cwjnQBugC2q
mcnNlE2u6a4FzlumU11nMZ+KKBsZW0die3jNAtTMHk5UgagPQ3k/0w==
=WnT+
-----END PGP SIGNATURE-----
100 changes: 100 additions & 0 deletions update-version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#
# this updates the (tagged) version of the software
#
# it will only update the "minor" version (e.g. 0.12.* -> 0.13.0)
#
# Any "options" are hard-coded in here (e.g. the GnuPG key to use)
#

import sys
import time
from datetime import datetime

from dulwich.repo import Repo
from dulwich.porcelain import (
tag_list,
tag_create,
status,
)

from twisted.internet.task import (
react,
)
from twisted.internet.defer import (
ensureDeferred,
)

author = "meejah <[email protected]>"


def existing_tags(git):
versions = [
tuple(map(int, v.decode("utf8").split(".")))
for v in tag_list(git)
]
return versions


def create_new_version(git, only_patch):
versions = existing_tags(git)
major, minor, patch = sorted(versions)[-1]
if only_patch:
next_version = "{}.{}.{}".format(major, minor, patch + 1)
else:
next_version = "{}.{}.{}".format(major, minor + 1, 0)
return next_version


async def main(reactor):
git = Repo(".")

# including untracked files can be very slow (if there are lots,
# like in virtualenvs) and we don't care anyway
st = status(git, untracked_files="no")
if any(st.staged.values()) or st.unstaged:
print("unclean checkout; aborting")
raise SystemExit(1)

for arg in sys.argv[1:]:
if arg not in ("--no-tag", "--patch"):
print("unknown arg: {}".format(arg))
raise SystemExit(2)

v = create_new_version(git, "--patch" in sys.argv)
if "--no-tag" in sys.argv:
print(v)
return

print("Latest version: {}.{}.{}".format(*sorted(existing_tags(git))[-1]))
print("New tag will be {}".format(v))

# the "tag time" is seconds from the epoch .. we quantize these to
# the start of the day in question, in UTC.
now = datetime.now()
s = now.utctimetuple()
ts = int(
time.mktime(
time.struct_time((
s.tm_year, s.tm_mon, s.tm_mday, 0, 0, 0, 0, s.tm_yday, 0
))
)
)
tag_create(
repo=git,
tag=v.encode("utf8"),
author=author.encode("utf8"),
message="release magic-wormhole-{}".format(v).encode("utf8"),
annotated=True,
objectish=b"HEAD",
sign=author.encode("utf8"),
tag_time=ts,
tag_timezone=0,
)

print("Tag created locally, it is not pushed")
print("To push it run something like:")
print(" git push origin {}".format(v))


if __name__ == "__main__":
react(lambda r: ensureDeferred(main(r)))
Loading