From e4130037da00c549731c52d65c360a2eece226a9 Mon Sep 17 00:00:00 2001 From: ETSound Date: Fri, 22 May 2026 21:30:07 -0700 Subject: [PATCH 1/2] Add CI/CD support --- .github/workflows/release.yml | 91 +++++++++++++++++++++++++++++++++++ build.py | 2 +- firmware_flasher.py | 4 +- pyproject.toml | 23 +++++++-- uv.lock | 71 ++++++++++++++++++++------- 5 files changed, 167 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..565907d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,91 @@ +name: Release + +on: + workflow_dispatch: + inputs: + tag: + description: Git tag for the release (e.g. v1.0.0-rc1) + required: true + type: string + prerelease: + description: Mark the GitHub release as a prerelease + type: boolean + default: true + +permissions: + contents: write + +jobs: + test: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + + - name: Install dependencies + run: uv sync --group dev + + - name: Ruff + run: uv run ruff check . + + build: + name: Build (${{ matrix.id }}) + needs: test + strategy: + fail-fast: false + matrix: + include: + # Add new rows here when supporting additional targets. + - id: win64 + runner: windows-latest + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v4 + + - uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + + - name: Install dependencies + run: uv sync --group build + + - name: Build executable + run: uv run python build.py + + - name: Stage release binary + shell: bash + run: cp dist/Firmware-Util.exe "Firmware-Util-${{ matrix.id }}.exe" + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.id }} + path: Firmware-Util-${{ matrix.id }}.exe + if-no-files-found: error + + deliver: + name: Publish release + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + path: release-assets + merge-multiple: true + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.event.inputs.tag }} + prerelease: ${{ github.event.inputs.prerelease == 'true' }} + generate_release_notes: true + files: release-assets/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.py b/build.py index ea9b7db..10e867d 100644 --- a/build.py +++ b/build.py @@ -40,7 +40,7 @@ def build_executable(): sys.exit(1) if __name__ == "__main__": - if sys.platform != "win32": + if sys.platform != "win32" and not os.environ.get("CI"): print("Warning: This should ideally be built on Windows for best compatibility.") print("Building on non-Windows platform may have issues.") input("Press Enter to continue anyway, or Ctrl+C to cancel...") diff --git a/firmware_flasher.py b/firmware_flasher.py index 38e7a36..d68a620 100644 --- a/firmware_flasher.py +++ b/firmware_flasher.py @@ -174,7 +174,7 @@ def __init__(self, root): try: if os.path.exists('icon.png'): self.root.iconphoto(True, tk.PhotoImage(file='icon.png')) - except: + except Exception: pass self.maroon = "#8B0000" @@ -862,7 +862,7 @@ def _flash_firmware_thread(self, bin_asset): def main(): root = tk.Tk() - app = FirmwareFlasher(root) + FirmwareFlasher(root) root.mainloop() if __name__ == "__main__": diff --git a/pyproject.toml b/pyproject.toml index 72e937c..d7025d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,25 @@ [project] -name = "repl-nix-workspace" -version = "0.1.0" -description = "Add your description here" +name = "Firmware-Util" +version = "1.0.0" +description = "SDR's Firmware Flashing & Setup Utility" requires-python = ">=3.11" dependencies = [ + "certifi>=2024.0.0", "py7zr>=1.0.0", - "pyinstaller>=6.16.0", "requests>=2.33.0", ] + +[dependency-groups] +build = [ + "pyinstaller>=6.16.0", +] +dev = [ + "ruff>=0.11.0", +] + +[tool.ruff] +target-version = "py311" +line-length = 120 + +[tool.ruff.lint.per-file-ignores] +"run_test.py" = ["F401"] diff --git a/uv.lock b/uv.lock index 94ee8ff..048120f 100644 --- a/uv.lock +++ b/uv.lock @@ -208,6 +208,35 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8a/1f/f041989e93b001bc4e44bb1669ccdcf54d3f00e628229a85b08d330615c5/charset_normalizer-3.4.3-py3-none-any.whl", hash = "sha256:ce571ab16d890d23b5c278547ba694193a45011ff86a9162a71307ed9f86759a", size = 53175, upload-time = "2025-08-09T07:57:26.864Z" }, ] +[[package]] +name = "firmware-util" +version = "1.0.0" +source = { virtual = "." } +dependencies = [ + { name = "certifi" }, + { name = "py7zr" }, + { name = "requests" }, +] + +[package.dev-dependencies] +build = [ + { name = "pyinstaller" }, +] +dev = [ + { name = "ruff" }, +] + +[package.metadata] +requires-dist = [ + { name = "certifi", specifier = ">=2024.0.0" }, + { name = "py7zr", specifier = ">=1.0.0" }, + { name = "requests", specifier = ">=2.33.0" }, +] + +[package.metadata.requires-dev] +build = [{ name = "pyinstaller", specifier = ">=6.16.0" }] +dev = [{ name = "ruff", specifier = ">=0.11.0" }] + [[package]] name = "idna" version = "3.15" @@ -557,23 +586,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/9e/15/b5ed5ad8c8d2d80c5f5d51e6c61b2cc05f93aaf171164f67ccc7ade815cd/pyzstd-0.17.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:e3a19e8521c145a0e2cd87ca464bf83604000c5454f7e0746092834fd7de84d1", size = 241668, upload-time = "2025-05-10T14:14:40.18Z" }, ] -[[package]] -name = "repl-nix-workspace" -version = "0.1.0" -source = { virtual = "." } -dependencies = [ - { name = "py7zr" }, - { name = "pyinstaller" }, - { name = "requests" }, -] - -[package.metadata] -requires-dist = [ - { name = "py7zr", specifier = ">=1.0.0" }, - { name = "pyinstaller", specifier = ">=6.16.0" }, - { name = "requests", specifier = ">=2.33.0" }, -] - [[package]] name = "requests" version = "2.33.0" @@ -589,6 +601,31 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/56/5d/c814546c2333ceea4ba42262d8c4d55763003e767fa169adc693bd524478/requests-2.33.0-py3-none-any.whl", hash = "sha256:3324635456fa185245e24865e810cecec7b4caf933d7eb133dcde67d48cee69b", size = 65017, upload-time = "2026-03-25T15:10:40.382Z" }, ] +[[package]] +name = "ruff" +version = "0.15.14" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/dc/8a/8bce2894573e9dae6ff4d77fe34ad727d79b9e6238ad288c5638990d90f6/ruff-0.15.14.tar.gz", hash = "sha256:48e866b165be4a9bdbf310f7d3c9a07edef2fe8cd63ffeb4e00bb590506ebf9f", size = 4700910, upload-time = "2026-05-21T14:34:55.177Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b9/c8/74a92c6ff9fcfb4f1f947126d3ebee8389276e161ecc85de5bda7cda51bd/ruff-0.15.14-py3-none-linux_armv6l.whl", hash = "sha256:8dd2db9416e487c8d4b01fa7056bb02c4d05969d4f8d17a08c229c2f4ff3c108", size = 10739177, upload-time = "2026-05-21T14:34:37.332Z" }, + { url = "https://files.pythonhosted.org/packages/45/91/254a35c20acc38a7223c9d2d594af12e794432464f2cdeb52af1dc4a892d/ruff-0.15.14-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:be4ff55af755bd71a00ab3dc6bd7ffc467bd76e0df6881e286c2e3d23e8fb43b", size = 11144969, upload-time = "2026-05-21T14:34:43.978Z" }, + { url = "https://files.pythonhosted.org/packages/56/9e/d13e40f83b8d0a94430e6778ce1d94a43b38cf2efe63278bdd2b4c65abbf/ruff-0.15.14-py3-none-macosx_11_0_arm64.whl", hash = "sha256:48d5909d7d06276ce7dde6d32bfa4b0d4cb2651145cd8ee4b440722cbc77832f", size = 10478207, upload-time = "2026-05-21T14:34:48.378Z" }, + { url = "https://files.pythonhosted.org/packages/8d/f1/b15a7839fa4f332f8acec78e20564f26bb2d866e3d21710b877fd0263000/ruff-0.15.14-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca8cbfa94c4f90984a67561978602746d4cd27103568f745fa90eee3f0d4107d", size = 10818459, upload-time = "2026-05-21T14:34:22.318Z" }, + { url = "https://files.pythonhosted.org/packages/45/33/53d651177f84f94b400a0e27f8824eeada3dddc9d5ee8aeb048f4352a520/ruff-0.15.14-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9a6bbc0333f1ab053423bcbf6226477d266ca7cec7738c4c8e3f55647803f3c4", size = 10541800, upload-time = "2026-05-21T14:34:20.209Z" }, + { url = "https://files.pythonhosted.org/packages/b8/a6/868f87e0bf9786ed24b5d0d0ad8676b8a94fd1912f42cddf9cfc7857818a/ruff-0.15.14-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8a24a4f7605d7003a6674d4387651effd939dead3fddd0f36561eb77a9a2e542", size = 11342149, upload-time = "2026-05-21T14:34:46.365Z" }, + { url = "https://files.pythonhosted.org/packages/a7/8b/38cd5c19faffdcc05a408d2b78edccc69492ab9720eadb49ea15ef80d768/ruff-0.15.14-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:049b5326e53ed80978f2fc041a280603f69dd6b0c95464342a2bb4572d9d9e2f", size = 12212563, upload-time = "2026-05-21T14:34:28.579Z" }, + { url = "https://files.pythonhosted.org/packages/3e/4d/a3c5b874a556d5731e3e657aaf04311bb76f0a5c3ec220ed43051be6b64b/ruff-0.15.14-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d4ed42e6696c8dfa5f06728e6441993901f548eb92d73bc472cb5a38d1395fbf", size = 11493299, upload-time = "2026-05-21T14:34:41.836Z" }, + { url = "https://files.pythonhosted.org/packages/1e/c0/56472c251d09858a53e51efbd485b09e1995d8731668b76d52e5dd6ee0f1/ruff-0.15.14-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:715c543cf450c4888251f91c52f1942a800541d9bddd7ac060aa4e6b77ae7cba", size = 11455931, upload-time = "2026-05-21T14:34:57.276Z" }, + { url = "https://files.pythonhosted.org/packages/2c/4a/e2e7b4d8dbf233d4eace59c75bc3435fa6d8bd3bae82d351d4e4300c0fd1/ruff-0.15.14-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:72ebab6013ec887d439d8b7593737a0a4ffb06d45d209d4e4bf2e92813082d3f", size = 11400794, upload-time = "2026-05-21T14:34:39.773Z" }, + { url = "https://files.pythonhosted.org/packages/97/c7/83c0539fe34c3e09136204d1e75d6052492364e0b3cb05e9465423f567d7/ruff-0.15.14-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:49072d36abdbe97a8dd7f480afe9c675699c0c495d4c84076e2c1203c4550581", size = 10804759, upload-time = "2026-05-21T14:34:31.045Z" }, + { url = "https://files.pythonhosted.org/packages/86/a6/18f2bfc095a2ab4a78745644e428205532ce6653a5d0fa8501572891534d/ruff-0.15.14-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:958522aee105068640c2c2ceae08f413ae44d922f52a1374ac13d6a96032fc93", size = 10539517, upload-time = "2026-05-21T14:34:53.064Z" }, + { url = "https://files.pythonhosted.org/packages/54/3a/5a8b3b69c654d4e4bf1d246ac5b49cbcdac6eaab6905925f8915f31e3b80/ruff-0.15.14-py3-none-musllinux_1_2_i686.whl", hash = "sha256:f3707da619a143a2e8830e2abab8224478d69ace2d28cb6c20543ae97c36bf61", size = 11065169, upload-time = "2026-05-21T14:34:24.484Z" }, + { url = "https://files.pythonhosted.org/packages/ed/c5/8864e4e7925b836ea354b31d57641ec03830564e281a8b6f061f8c3e0ec1/ruff-0.15.14-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:bb01d645694e3ec0102105d07ef2d53703970407d59c04e59d3ba0b7a1d53553", size = 11560214, upload-time = "2026-05-21T14:34:50.975Z" }, + { url = "https://files.pythonhosted.org/packages/36/38/012bf76752e1f89ed50b77b99532d90f3a3e287bc7918e1fc0948ac866ac/ruff-0.15.14-py3-none-win32.whl", hash = "sha256:6d0c1ad2a0ab718d39b6d8fd2217981ce4d625cd96a720095f798fb47d8b13e6", size = 10805548, upload-time = "2026-05-21T14:34:33.453Z" }, + { url = "https://files.pythonhosted.org/packages/d1/b7/4ea2c170f10ad760fff2a5250beb18897719dc8b52b53a24cddbb9dd3f19/ruff-0.15.14-py3-none-win_amd64.whl", hash = "sha256:802342981e056db3851a7836e5b070f8f15f67d4a685ae2a6160939d364b2902", size = 11939523, upload-time = "2026-05-21T14:34:18.077Z" }, + { url = "https://files.pythonhosted.org/packages/62/d5/bc97ff895ec35cf3925d4bd60f3b39d822f377a446906ec9bcc87405e59b/ruff-0.15.14-py3-none-win_arm64.whl", hash = "sha256:ff47b90a9ef6a40c9e2f3b479c1fb78531adf055b94c1eba0a7ba04b31951826", size = 11208607, upload-time = "2026-05-21T14:34:26.525Z" }, +] + [[package]] name = "setuptools" version = "80.9.0" From f8a451197261222906a131ea6cfdca66d1b6875e Mon Sep 17 00:00:00 2001 From: etsells <147210601+ETSells@users.noreply.github.com> Date: Fri, 22 May 2026 21:32:07 -0700 Subject: [PATCH 2/2] Potential fix for pull request finding 'Empty except' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- firmware_flasher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/firmware_flasher.py b/firmware_flasher.py index d68a620..c687334 100644 --- a/firmware_flasher.py +++ b/firmware_flasher.py @@ -174,8 +174,9 @@ def __init__(self, root): try: if os.path.exists('icon.png'): self.root.iconphoto(True, tk.PhotoImage(file='icon.png')) - except Exception: - pass + except Exception as e: + # Icon loading is optional; continue startup if it fails. + print(f"Warning: failed to set application icon: {e}", file=sys.stderr) self.maroon = "#8B0000" self.white = "#FFFFFF"