From 8a7f185564897c3139e6209da96ea3a85e1b53f1 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Mon, 7 Jun 2021 14:10:56 +0100 Subject: [PATCH] Remove outdated build scripts #nolog --- bin/mkchangelog.py | 49 ---------------------------------------------- bin/release | 48 --------------------------------------------- 2 files changed, 97 deletions(-) delete mode 100644 bin/mkchangelog.py delete mode 100755 bin/release diff --git a/bin/mkchangelog.py b/bin/mkchangelog.py deleted file mode 100644 index ef48961..0000000 --- a/bin/mkchangelog.py +++ /dev/null @@ -1,49 +0,0 @@ -import datetime -import re -import sys -import git - -URL = 'https://github.com/miguelgrinberg/flask-migrate' -merges = {} - - -def format_message(commit): - if commit.message.startswith('Version '): - return '' - if '#nolog' in commit.message: - return '' - if commit.message.startswith('Merge pull request'): - pr = commit.message.split('#')[1].split(' ')[0] - message = ' '.join([line for line in [line.strip() for line in commit.message.split('\n')[1:]] if line]) - merges[message] = pr - return '' - if commit.message.startswith('Release '): - return '\n**{message}** - {date}\n'.format( - message=commit.message.strip(), - date=datetime.datetime.fromtimestamp(commit.committed_date).strftime('%Y-%m-%d')) - message = ' '.join([line for line in [line.strip() for line in commit.message.split('\n')] if line]) - if message in merges: - message += ' #' + merges[message] - message = re.sub('\\(.*(#[0-9]+)\\)', '\\1', message) - message = re.sub('Fixes (#[0-9]+)', '\\1', message) - message = re.sub('fixes (#[0-9]+)', '\\1', message) - message = re.sub('#([0-9]+)', '[#\\1]({url}/issues/\\1)'.format(url=URL), message) - message += ' ([commit]({url}/commit/{sha}))'.format(url=URL, sha=str(commit)) - if commit.author.name != 'Miguel Grinberg': - message += ' (thanks **{name}**!)'.format(name=commit.author.name) - return '- ' + message - - -def main(all=False): - repo = git.Repo() - - for commit in repo.iter_commits(): - if not all and commit.message.startswith('Release '): - break - message = format_message(commit) - if message: - print(message) - - -if __name__ == '__main__': - main(all=len(sys.argv) > 1 and sys.argv[1] == 'all') diff --git a/bin/release b/bin/release deleted file mode 100755 index 76de06b..0000000 --- a/bin/release +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -ex - -VERSION="$1" -VERSION_FILE=__version__ - -if [[ "$VERSION" == "" ]]; then - echo "Usage: $0 " -fi - -# update change log -head -n 2 CHANGES.md > _CHANGES.md -echo "**Release $VERSION** - $(date +%F)" >> _CHANGES.md -echo "" >> _CHANGES.md -pip install gitpython -python bin/mkchangelog.py >> _CHANGES.md -echo "" >> _CHANGES.md -len=$(wc -l < CHANGES.md) -tail -n $(expr $len - 2) CHANGES.md >> _CHANGES.md -vim _CHANGES.md -set +e -grep -q ABORT _CHANGES.md -if [[ "$?" == "0" ]]; then - rm _CHANGES.md - echo "Aborted." - exit 1 -fi -set -e -mv _CHANGES.md CHANGES.md - -echo $VERSION > $VERSION_FILE -rm -rf dist -pip install --upgrade pip wheel twine -python setup.py sdist bdist_wheel --universal - -git add $VERSION_FILE CHANGES.md -git commit -m "Release $VERSION" -git tag -f v$VERSION -git push --tags origin main - -read -p "Press any key to submit to PyPI or Ctrl-C to abort..." -n1 -s -twine upload dist/* - -NEW_VERSION="${VERSION%.*}.$((${VERSION##*.}+1))dev" -echo $NEW_VERSION > $VERSION_FILE -git add $VERSION_FILE -git commit -m "Version $NEW_VERSION" -git push origin main -echo "Development is now open on version $NEW_VERSION!"