Skip to content

Commit 671566e

Browse files
scszcoderclaude
andcommitted
ws049: fix CI build break — gate pywifi to Python <3.12 (no 3.12 release)
The release CI (GitHub Actions, Python 3.12) failed at `pip install -r requirements-windows.txt` with "No matching distribution found for pywifi>=1.1.12": pywifi's latest (1.1.12) declares Requires-Python <3.12, so on the 3.12 runner every version is filtered out. Pre-existing latent break (identical on master; unrelated to the ws046-048 agent-code changes) that only surfaces on a clean 3.12 install. pywifi is an OPTIONAL hardware-fingerprint signal (Windows WiFi SSID scan) the code already degrades gracefully without (hardware_detector.py wraps `from pywifi import PyWiFi` in try/except → "skipping Windows WiFi scan"). So: - requirements-windows.txt: add `and python_version < "3.12"` so pip skips it on 3.12 instead of failing the whole install. - hook-pywifi.py: only declare the hidden imports when pywifi is importable, so PyInstaller doesn't warn about bundling a missing module on 3.12. Tradeoff: 3.12 builds ship without the WiFi-scan fingerprint signal (gracefully skipped). Alternative if that signal matters: pin CI Python to 3.11. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 63a5d6d commit 671566e

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

build_system/pyinstaller_hooks/hook-pywifi.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@
66
"""
77
import sys
88

9-
# Only include pywifi modules on Windows
9+
# Only include pywifi modules on Windows AND only when it is actually installed.
10+
# pywifi has no release for Python >=3.12, so on a 3.12 build it is absent and the
11+
# runtime falls back gracefully (hardware_detector.py skips the WiFi scan). Guard
12+
# the hidden imports on importability so PyInstaller doesn't warn/fail on a missing
13+
# module it was told to bundle.
1014
if sys.platform == 'win32':
11-
hiddenimports = [
12-
'pywifi',
13-
'pywifi.const',
14-
'pywifi.ifaces',
15-
]
16-
print("[HOOK] Including pywifi for Windows")
15+
import importlib.util
16+
if importlib.util.find_spec('pywifi') is not None:
17+
hiddenimports = [
18+
'pywifi',
19+
'pywifi.const',
20+
'pywifi.ifaces',
21+
]
22+
print("[HOOK] Including pywifi for Windows")
23+
else:
24+
hiddenimports = []
25+
print("[HOOK] Skipping pywifi (not installed — e.g. Python >=3.12)")
1726
else:
1827
hiddenimports = []
1928
print("[HOOK] Skipping pywifi (not Windows)")

requirements-windows.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@
44
# Windows specific packages
55
pywin32>=310; platform_system == "Windows"
66
pywin32-ctypes>=0.2.2; platform_system == "Windows"
7-
pywifi>=1.1.12; platform_system == "Windows"
7+
# pywifi caps at Requires-Python <3.12, so on the 3.12 CI/runtime it has NO
8+
# installable release ("No matching distribution found"). It is an OPTIONAL
9+
# hardware-fingerprint signal (Windows WiFi SSID scan) that the code already
10+
# degrades gracefully without (hardware_detector.py: try/except ImportError ->
11+
# "pywifi not installed; skipping Windows WiFi scan"), so gate it to <3.12
12+
# instead of failing the entire install on 3.12.
13+
pywifi>=1.1.12; platform_system == "Windows" and python_version < "3.12"
814
comtypes>=1.2.0; platform_system == "Windows" # Required by pywifi for COM interface

0 commit comments

Comments
 (0)