From b837134a83e252f6d0ac1ac3cf77df6709f5bce9 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 4 Jun 2026 16:28:52 -0400 Subject: [PATCH] chore(deps): use lizardbyte-common for python helpers --- .flake8 | 7 ------ .github/workflows/ci.yml | 36 +++++++++++++++---------------- .gitmodules | 4 ++++ scripts/pyproject.toml | 30 -------------------------- scripts/update_clang_format.py | 39 ---------------------------------- third-party/lizardbyte-common | 1 + 6 files changed, 23 insertions(+), 94 deletions(-) delete mode 100644 .flake8 delete mode 100644 scripts/pyproject.toml delete mode 100644 scripts/update_clang_format.py create mode 160000 third-party/lizardbyte-common diff --git a/.flake8 b/.flake8 deleted file mode 100644 index a8948ef..0000000 --- a/.flake8 +++ /dev/null @@ -1,7 +0,0 @@ -[flake8] -filename = - *.py -max-line-length = 120 -extend-exclude = - .venv/ - venv/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d85d40..ab37f1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,9 @@ concurrency: group: "${{ github.workflow }}-${{ github.ref }}" cancel-in-progress: true +env: + PYTHON_VERSION: '3.14' + jobs: setup_release: name: Setup Release @@ -113,23 +116,21 @@ jobs: id: setup-python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: - python-version: '3.14' + python-version: ${{ env.PYTHON_VERSION }} + + - name: Setup uv + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + with: + enable-cache: true - - name: Python Path - id: python-path + - name: Sync Python tools env: - TMP_PYTHON_PATH: ${{ steps.setup-python.outputs.python-path }} + MSYS2_PATH_TYPE: inherit + UV_PYTHON: ${{ steps.setup-python.outputs.python-path }} run: | - if [ "${RUNNER_OS}" == "Windows" ]; then - # replace backslashes with double backslashes - python_path=$(echo "${TMP_PYTHON_PATH}" | sed 's/\\/\\\\/g') - else - python_path="${TMP_PYTHON_PATH}" - fi - - # step output - echo "python-path=${python_path}" - echo "python-path=${python_path}" >> "${GITHUB_OUTPUT}" + uv sync --project third-party/lizardbyte-common --locked --only-group test-c \ + --no-python-downloads \ + --no-install-project - name: Build env: @@ -165,12 +166,11 @@ jobs: if: >- always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure') - env: - PYTHON_PATH: ${{ steps.python-path.outputs.python-path }} working-directory: build + env: + MSYS2_PATH_TYPE: inherit run: | - "${PYTHON_PATH}" -m pip install "../scripts[test]" - "${PYTHON_PATH}" -m gcovr . -r ../src \ + uv run --project ../third-party/lizardbyte-common --locked --no-sync gcovr . -r ../src \ --exclude-noncode-lines \ --exclude-throw-branches \ --exclude-unreachable-branches \ diff --git a/.gitmodules b/.gitmodules index e3099df..e21742b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,3 +6,7 @@ path = third-party/googletest url = https://github.com/google/googletest.git branch = v1.14.x +[submodule "third-party/lizardbyte-common"] + path = third-party/lizardbyte-common + url = https://github.com/LizardByte/lizardbyte-common.git + branch = master diff --git a/scripts/pyproject.toml b/scripts/pyproject.toml deleted file mode 100644 index f49930f..0000000 --- a/scripts/pyproject.toml +++ /dev/null @@ -1,30 +0,0 @@ -[build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "libdisplaydevice" -dynamic = ["version"] -description = "Helper scripts for libdisplaydevice" -requires-python = ">=3.14" -license = {text = "AGPL-3.0-only"} -authors = [ - {name = "LizardByte", email = "lizardbyte@users.noreply.github.com"} -] - -dependencies = [] - -[project.optional-dependencies] -lint = [ - "clang-format==21.*", - "flake8==7.3.0", -] - -test = [ - "gcovr==8.6", -] - -[project.urls] -Homepage = "https://github.com/LizardByte/libdisplaydevice#readme" -Repository = "https://github.com/LizardByte/libdisplaydevice" -Issues = "https://github.com/LizardByte/libdisplaydevice/issues" diff --git a/scripts/update_clang_format.py b/scripts/update_clang_format.py deleted file mode 100644 index 5e5f917..0000000 --- a/scripts/update_clang_format.py +++ /dev/null @@ -1,39 +0,0 @@ -# standard imports -import os -import subprocess - -# variables -directories = [ - 'src', - 'tests', -] -file_types = [ - 'c', - 'cpp', - 'h', - 'h', - 'm', - 'mm' -] - - -def clang_format(file: str): - print(f'Formatting {file} ...') - subprocess.run(['clang-format', '-i', file]) - - -def main(): - """ - Main entry point. - """ - # walk the directories - for directory in directories: - for root, dirs, files in os.walk(directory): - for file in files: - file_path = os.path.join(root, file) - if os.path.isfile(file_path) and file.rsplit('.')[-1] in file_types: - clang_format(file=file_path) - - -if __name__ == '__main__': - main() diff --git a/third-party/lizardbyte-common b/third-party/lizardbyte-common new file mode 160000 index 0000000..c049430 --- /dev/null +++ b/third-party/lizardbyte-common @@ -0,0 +1 @@ +Subproject commit c049430764e3ce04d86d1dd05a3ad9224a676e5c