Skip to content

Commit

Permalink
Rearrange releasing helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
otsaloma committed Oct 2, 2021
1 parent 94d6b22 commit 7bc1c2c
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 124 deletions.
60 changes: 60 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- coding: utf-8-unix -*-

# EDITOR must wait!
EDITOR = nano

check:
flake8 bin/gaupol
flake8 aeidon
flake8 gaupol
flake8 data/extensions/*/*.py
flake8 *.py

clean:
./setup.py clean

install:
./setup.py install

publish-aeidon:
$(MAKE) check test clean
./setup-aeidon.py sdist bdist_wheel
test -s dist/aeidon-*-py3-none-any.whl
test -s dist/aeidon-*.tar.gz
ls -l dist
printf "Press Enter to upload or Ctrl+C to abort: "; read _
twine upload dist/*
sudo pip3 uninstall -y aeidon || true
sudo pip3 uninstall -y aeidon || true
sudo pip3 install -U aeidon
cd && python3 -c "import aeidon; print(aeidon.__file__, aeidon.__version__)"

# Interactive!
release:
$(MAKE) check test clean
@echo "BUMP VERSION NUMBERS"
$(EDITOR) aeidon/__init__.py
$(EDITOR) gaupol/__init__.py
$(EDITOR) data/extensions/*/*.in
$(EDITOR) win32/gaupol.iss
@echo "ADD RELEASE NOTES"
$(EDITOR) NEWS.md
$(EDITOR) data/io.otsaloma.gaupol.appdata.xml.in
sudo ./setup.py install --prefix=/usr/local clean
/usr/local/bin/gaupol
tools/release
@echo "REMEMBER TO make publish-aeidon"
@echo "REMEMBER TO UPDATE FLATPAK"
@echo "REMEMBER TO UPDATE WEBSITE"

test:
py.test -xs aeidon gaupol data/extensions

# Interactive!
translations:
tools/update-translations

warnings:
python3 -Wd bin/gaupol

.PHONY: check clean install publish-aeidon release test translations warnings
31 changes: 0 additions & 31 deletions RELEASING.md

This file was deleted.

1 change: 0 additions & 1 deletion tools/check-translations
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Check translation files for common errors.
Usage: check-translations [XX[_YY[@ZZ]]...]
Expand Down
79 changes: 79 additions & 0 deletions tools/extract-translations
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/sh

cd "$(dirname "$0")/.." || exit 1
truncate -s0 po/gaupol.pot

# Python code
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
--language=Python \
--keyword=_:1 \
--keyword=d_:2 \
--keyword=n_:1,2 \
--add-comments=TRANSLATORS: \
$(find . -name "*.py" -not -path "*/test/*")

# GtkBuilder XML files
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
$(find data -name "*.ui")

# Extension metadata files
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
--language=Desktop \
--keyword= \
--keyword=Name \
--keyword=Description \
--add-comments=TRANSLATORS: \
data/extensions/*/*.extension.in

# Pattern files
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
--language=Desktop \
--keyword= \
--keyword=Name \
--keyword=Description \
--add-comments=TRANSLATORS: \
data/patterns/*.in

# AppData XML file
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
data/io.otsaloma.gaupol.appdata.xml.in

# Desktop file
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
--language=Desktop \
--keyword= \
--keyword=GenericName \
--keyword=Comment \
--keyword=Keywords \
--add-comments=TRANSLATORS: \
data/io.otsaloma.gaupol.desktop.in

# XXX: Fix charset=CHARSET which causes msggrep to fail.
sed -i s/charset=CHARSET/charset=UTF-8/ po/gaupol.pot

# Remove AppData entries that shouldn't be translated.
msggrep \
--invert-match \
--msgid \
--regexp="^Gaupol$" \
--regexp="^Osmo Salomaa$" \
--output-file=po/tmp.pot \
po/gaupol.pot && mv -f po/tmp.pot po/gaupol.pot
17 changes: 0 additions & 17 deletions tools/publish-aeidon

This file was deleted.

91 changes: 16 additions & 75 deletions tools/update-translations
Original file line number Diff line number Diff line change
@@ -1,76 +1,17 @@
#!/bin/sh

#!/bin/bash
set -e
cd "$(dirname "$0")/.." || exit 1
truncate -s0 po/gaupol.pot

# Python code
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
--language=Python \
--keyword=_:1 \
--keyword=d_:2 \
--keyword=n_:1,2 \
--add-comments=TRANSLATORS: \
$(find . -name "*.py" -not -path "*/test/*")

# GtkBuilder XML files
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
$(find data -name "*.ui")

# Extension metadata files
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
--language=Desktop \
--keyword= \
--keyword=Name \
--keyword=Description \
--add-comments=TRANSLATORS: \
data/extensions/*/*.extension.in

# Pattern files
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
--language=Desktop \
--keyword= \
--keyword=Name \
--keyword=Description \
--add-comments=TRANSLATORS: \
data/patterns/*.in

# AppData XML file
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
data/io.otsaloma.gaupol.appdata.xml.in

# Desktop file
xgettext \
--output=po/gaupol.pot \
--join-existing \
--from-code=UTF-8 \
--language=Desktop \
--keyword= \
--keyword=GenericName \
--keyword=Comment \
--keyword=Keywords \
--add-comments=TRANSLATORS: \
data/io.otsaloma.gaupol.desktop.in

# Remove AppData entries that shouldn't be translated.
msggrep \
--invert-match \
--msgid \
--regexp="^Gaupol$" \
--regexp="^Osmo Salomaa$" \
--output-file=po/tmp.pot \
po/gaupol.pot && mv -f po/tmp.pot po/gaupol.pot
tools/extract-translations
tx push -s
tx pull -af --minimum-perc=50
emacs1 po/fi.po
tx push -tf --no-interactive -l fi
for PO in po/*.po; do
LANG=$(basename $PO .po)
tools/check-translations $LANG
read -p "Keep? [Y/n] "
[ "$REPLY" = "n" ] && rm -fv $PO
done
# rm -f po/LINGUAS
# ls po/*.po | cut -d/ -f2 | cut -d. -f1 > po/LINGUAS
git status

0 comments on commit 7bc1c2c

Please sign in to comment.