Skip to content
Merged
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
18 changes: 16 additions & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and update Documentation
name: Build and update documentation

# Daily at 0 am
on:
Expand Down Expand Up @@ -31,7 +31,9 @@ jobs:
- name: Install dependencies via package manager
run: |
sudo apt update
sudo apt install -y gettext
sudo apt install -y gettext hunspell hunspell-pt-br
msgfmt -V
hunspell -v

- name: Prepare virtual environment
run: |
Expand Down Expand Up @@ -79,6 +81,18 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check spelling of translations
run: |
make spell
cd .pospell/
tar -czf ../pospell-out.tar.gz *.txt **/*.txt

- name: Make spellchecking output available
uses: actions/upload-artifact@v1
with:
name: spellchecking-output
path: pospell-out.tar.gz

- name: Build documentation treating warnings as errors
run: |
make build CPYTHON_PATH=/tmp/cpython/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.mo
.tx/**/*.po
venv/
.pospell/
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ LOCALE_DIR := $(WORKDIRS)/locale
JOBS := auto
SPHINXERRORHANDLING := "-W"
TRANSIFEX_PROJECT := python-newest
POSPELL_TMP_DIR := .pospell


.PHONY: help
Expand All @@ -34,6 +35,7 @@ help:
@echo " tx-config Recreate an up-to-date project .tx/config; calls 'pot'"
@echo " pot Create/Update POT files from source files"
@echo " serve Serve a built documentation on http://localhost:8000"
@echo " spell Check spelling, storing output in $(POSPELL_TMP_DIR)"
@echo ""


Expand Down Expand Up @@ -177,9 +179,32 @@ serve:
$(MAKE) -C $(CPYTHON_WORKDIR)/Doc serve


# list files for spellchecking
SRCS := $(wildcard *.po **/*.po)
DESTS = $(addprefix $(POSPELL_TMP_DIR)/out/,$(patsubst %.po,%.txt,$(SRCS)))


# spell: run spell checking tool in all po files listed in SRCS variable,
# storing the output in text files DESTS for proofreading. The
# DESTS target run the spellchecking, while the typos.txt target
# gather all reported issues in one file, sorted without redundancy
.PHONY: spell
spell: venv $(DESTS) $(POSPELL_TMP_DIR)/typos.txt

$(POSPELL_TMP_DIR)/out/%.txt: %.po dict
@echo "Checking $< ..."
@mkdir -p $(@D)
@$(VENV)/bin/pospell -l $(LANGUAGE) -p dict $< > $@ || true

$(POSPELL_TMP_DIR)/typos.txt:
@echo "Gathering all typos in $(POSPELL_TMP_DIR)/typos.txt ..."
@cut -d: -f3- $(DESTS) | sort -u > $@


# clean: remove all .mo files and the venv directory that may exist and
# could have been created by the actions in other targets of this script
.PHONY: clean
clean:
rm -fr $(VENV)
rm -rf $(POSPELL_TMP_DIR)
find -name '*.mo' -delete
Loading