diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 34be5f7cc..bab069b74 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,6 +36,14 @@ jobs: - run: SEVERITY=warning make shell-check + test-tools: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: make all + working-directory: tools + test-legacy: strategy: matrix: diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 44f1f97a3..a91064143 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -41,7 +41,7 @@ jobs: - name: Generate packages list run: | - scripts/packages.py --dev --format line ${{ matrix.release }} \ + tools/packages.py --dev --format line ${{ matrix.release }} \ python_apps/airtime_analyzer \ python_apps/pypo \ > packages.list diff --git a/install b/install index 9661a7a7e..4fc6391ba 100755 --- a/install +++ b/install @@ -764,7 +764,7 @@ if [ "$ignore_dependencies" = "f" ]; then set -e package_list=$( - "${SCRIPT_DIR}/scripts/packages.py" --format=line "${code}" "${packages_files[@]}" || + "${SCRIPT_DIR}/tools/packages.py" --format=line "${code}" "${packages_files[@]}" || (echo "ERROR: could not generate packages list" >&2 && exit 1) ) set +e diff --git a/tools/.pylintrc b/tools/.pylintrc new file mode 100644 index 000000000..b274cc0fe --- /dev/null +++ b/tools/.pylintrc @@ -0,0 +1,3 @@ +[MESSAGES CONTROL] +disable=missing-module-docstring, + missing-function-docstring diff --git a/scripts/Makefile b/tools/Makefile similarity index 65% rename from scripts/Makefile rename to tools/Makefile index bc226fd86..511ba08af 100644 --- a/scripts/Makefile +++ b/tools/Makefile @@ -8,11 +8,16 @@ all: lint test venv: python3 -m venv venv - source venv/bin/active + source venv/bin/activate pip install -r requirements-dev.txt lint: venv - pylint scripts + source venv/bin/activate + pylint tools test: venv + source venv/bin/activate pytest -n ${CPU_CORES} --color=yes -v . + +clean: + rm -Rf venv diff --git a/scripts/README.md b/tools/README.md similarity index 85% rename from scripts/README.md rename to tools/README.md index 2b553b0fd..bbceacedf 100644 --- a/scripts/README.md +++ b/tools/README.md @@ -1,3 +1,3 @@ -# Scripts +# Tools This folder contains scripts/tools to manage the project. diff --git a/scripts/__init__.py b/tools/__init__.py similarity index 100% rename from scripts/__init__.py rename to tools/__init__.py diff --git a/scripts/packages.py b/tools/packages.py similarity index 97% rename from scripts/packages.py rename to tools/packages.py index e6a235d99..ed5c32a26 100755 --- a/scripts/packages.py +++ b/tools/packages.py @@ -1,10 +1,7 @@ #!/usr/bin/env python3 -import json -import sys from argparse import ArgumentParser from configparser import ConfigParser -from os import PathLike from pathlib import Path from typing import Iterator, Set @@ -62,7 +59,7 @@ def run(): choices=FORMATS, help="print packages list in a specific format.", default="list", - ), + ) parser.add_argument( "-d", "--dev", diff --git a/scripts/packages_test.py b/tools/packages_test.py similarity index 67% rename from scripts/packages_test.py rename to tools/packages_test.py index bdd9edb06..f4d095f74 100644 --- a/scripts/packages_test.py +++ b/tools/packages_test.py @@ -1,8 +1,8 @@ from pathlib import Path -from .packages import list_packages, load_packages +from tools.packages import list_packages, load_packages -package_ini = """ +PACKAGE_INI = """ [common] postgresql = buster # Some comment @@ -20,13 +20,13 @@ result2 = {"apache2", "curl", "ffmpeg"} def test_load_packages(): - assert load_packages(package_ini, "buster", False) == result1 - assert load_packages(package_ini, "bionic", True) == result2 + assert load_packages(PACKAGE_INI, "buster", False) == result1 + assert load_packages(PACKAGE_INI, "bionic", True) == result2 def test_list_packages(tmp_path: Path): package_file = tmp_path / "packages.ini" - package_file.write_text(package_ini) + package_file.write_text(PACKAGE_INI) assert list_packages([tmp_path, package_file], "buster", False) == result1 assert list_packages([tmp_path, package_file], "bionic", True) == result2 diff --git a/scripts/requirements-dev.txt b/tools/requirements-dev.txt similarity index 100% rename from scripts/requirements-dev.txt rename to tools/requirements-dev.txt