mirror of
https://github.com/codespell-project/codespell.git
synced 2025-05-17 15:36:17 +08:00

* MAINT: Use pyproject and setuptools_scm * FIX: Name * FIX: Better * FIX: Better * FIX: Better * FIX: Ver * Update .github/workflows/codespell-private.yml Co-authored-by: Peter Newman <peternewman@users.noreply.github.com> Co-authored-by: Peter Newman <peternewman@users.noreply.github.com>
61 lines
1.8 KiB
Makefile
61 lines
1.8 KiB
Makefile
SORT_ARGS := -f -b
|
|
|
|
DICTIONARIES := codespell_lib/data/dictionary*.txt
|
|
|
|
PHONY := all check check-dictionaries sort-dictionaries trim-dictionaries check-dictionary sort-dictionary trim-dictionary check-manifest check-distutils flake8 pytest pypi clean
|
|
|
|
all: check-dictionaries codespell.1
|
|
|
|
check: check-dictionaries check-manifest check-distutils flake8 pytest
|
|
|
|
check-dictionary: check-dictionaries
|
|
sort-dictionary: sort-dictionaries
|
|
trim-dictionary: trim-dictionaries
|
|
|
|
codespell.1: codespell.1.include bin/codespell Makefile
|
|
PYTHONPATH=. help2man ./bin/codespell --include codespell.1.include --no-info --output codespell.1
|
|
sed -i '/\.SS \"Usage/,+2d' codespell.1
|
|
|
|
check-dictionaries:
|
|
@for dictionary in ${DICTIONARIES}; do \
|
|
if ! LC_ALL=C sort ${SORT_ARGS} -c $$dictionary; then \
|
|
echo "Dictionary $$dictionary not sorted. Sort with 'make sort-dictionaries'"; \
|
|
exit 1; \
|
|
fi; \
|
|
if grep -E -n "^\s*$$|\s$$|^\s" $$dictionary; then \
|
|
echo "Dictionary $$dictionary contains leading/trailing whitespace and/or blank lines. Trim with 'make trim-dictionaries'"; \
|
|
exit 1; \
|
|
fi; \
|
|
done
|
|
@if command -v pytest > /dev/null; then \
|
|
pytest codespell_lib/tests/test_dictionary.py; \
|
|
else \
|
|
echo "Test dependencies not present, install using 'pip install -e \".[dev]\"'"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
sort-dictionaries:
|
|
@for dictionary in ${DICTIONARIES}; do \
|
|
LC_ALL=C sort ${SORT_ARGS} -u -o $$dictionary $$dictionary; \
|
|
done
|
|
|
|
trim-dictionaries:
|
|
@for dictionary in ${DICTIONARIES}; do \
|
|
sed -E -i.bak -e 's/^[[:space:]]+//; s/[[:space:]]+$$//; /^$$/d' $$dictionary && rm $$dictionary.bak; \
|
|
done
|
|
|
|
check-manifest:
|
|
check-manifest --no-build-isolation
|
|
|
|
check-distutils:
|
|
python setup.py check --restructuredtext --strict
|
|
|
|
flake8:
|
|
flake8
|
|
|
|
pytest:
|
|
pytest codespell_lib
|
|
|
|
clean:
|
|
rm -rf codespell.1
|