diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 8bbda6fc3..06ceac691 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -32,14 +32,14 @@ jobs: - name: Set Up Python ${{ matrix.python-version }} uses: actions/setup-python@v4.5.0 with: - python-version: ${{ matrix.python-version }} cache: pip cache-dependency-path: requirements/dev.txt + python-version: ${{ matrix.python-version }} - name: Install Dependencies run: | - python -m pip install -U pip wheel 'coveralls>=3' - python -m pip install -U -r requirements/dev.txt - python -m pip install -e . + python -m pip install --upgrade 'coveralls>=3' pip + python -m pip install --upgrade --requirement requirements/dev.txt + python -m pip install --editable . - name: Run Tests run: | make test @@ -58,7 +58,7 @@ jobs: steps: - name: Finished run: | - pip3 install -U 'coveralls>=3' + python -m pip install --upgrade 'coveralls>=3' pip coveralls --finish --service=github env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -75,11 +75,11 @@ jobs: python-version: '3.11' - name: Install Dependencies run: | - python -m pip install -U pip wheel - pip install -U . + python -m pip install --upgrade build pip + pip install --upgrade . - name: Build Distribution run: | - python setup.py sdist bdist_wheel + make build - name: Publish Package uses: pypa/gh-action-pypi-publish@v1.6.4 diff --git a/MANIFEST.in b/MANIFEST.in index 53736ca68..a0e0509b7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,7 @@ -exclude tests/* -recursive-include holidays/locale *.mo -recursive-include holidays/locale *.po -include *.py -include *.rst include CHANGES include holidays/py.typed -include LICENSE -include scripts/l10n/msgfmt.py +recursive-include docs * +recursive-include holidays *.py +recursive-include holidays/locale *.(mp)o +recursive-include scripts/l10n *.py +recursive-include tests *.py diff --git a/Makefile b/Makefile index 19bd62855..38c4a3e3f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ help: @echo "Usage: make " + @echo " build build distribution" @echo " check run pre-commit and tests" @echo " coverage identify code not covered with tests" @echo " help show summary of available commands" @@ -9,6 +10,10 @@ help: @echo " test run tests (in parallel)" @echo " tox run tox (in parallel)" +build: + scripts/l10n/generate_mo_files.py + python -m build + check: make pre-commit make doc diff --git a/requirements/dev.txt b/requirements/dev.txt index aa28af83a..fcf6515c3 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -20,5 +20,5 @@ chameleon lingua # Deployment. +build pip>=19.2.3 -wheel>=0.33.6 diff --git a/scripts/l10n/generate_mo_files.py b/scripts/l10n/generate_mo_files.py index 8f45aec6a..5ef89b22a 100755 --- a/scripts/l10n/generate_mo_files.py +++ b/scripts/l10n/generate_mo_files.py @@ -22,14 +22,12 @@ class MOGenerator: def run(self): """Runs the .mo files generation process.""" - # Delete old files. - for mo_file in Path(os.path.join("holidays", "locale")).rglob("*.mo"): - os.unlink(str(mo_file)) - - # Create new files. for po_path in Path(os.path.join("holidays", "locale")).rglob("*.po"): po_file = str(po_path) mo_file = po_file.replace(".po", ".mo") + + if os.path.exists(mo_file): + os.unlink(mo_file) subprocess.run( ( sys.executable, diff --git a/setup.py b/setup.py index 4f03c8e33..24dc6a66d 100644 --- a/setup.py +++ b/setup.py @@ -9,34 +9,7 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) -import os -import subprocess -import sys -from pathlib import Path - from setuptools import setup - -def generate_mo_files(): - """Looks up for .po files and generates respective .mo files.""" - for po_path in Path(os.path.join("holidays", "locale")).rglob("*.po"): - po_file = str(po_path) - mo_file = po_file.replace(".po", ".mo") - - if os.path.exists(mo_file): - os.unlink(mo_file) - subprocess.run( - ( - sys.executable, - os.path.join("scripts", "l10n", "msgfmt.py"), - "-o", - mo_file, - po_file, - ), - check=True, - ) - - if __name__ == "__main__": - generate_mo_files() setup()