From 66f272ffd08bbfd72eed38f5ae5c7197f7507222 Mon Sep 17 00:00:00 2001 From: Shrashti1234 Date: Wed, 4 Nov 2026 13:20:59 +0530 Subject: [PATCH] Install the built commoncode wheel on Windows Discover the commoncode wheel produced by flot instead of referring to a hardcoded 32.5.2 filename. Stop on build and install errors, and reject missing or ambiguous wheel selections so a stale artifact cannot be selected silently. Verified configure --dev installs commoncode 33.0.0 and completes successfully. Exercised the production selection block with current/future versions, paths containing spaces, no wheels, multiple wheels, and a failed installer. Signed-off-by: Shrashti1234 --- AUTHORS.rst | 1 + CHANGELOG.rst | 3 +++ configure.bat | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 9a8224dc7da..72a9863d2b1 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -84,6 +84,7 @@ The following organizations or individuals have contributed to ScanCode: - Sebastian Schuberth @sschuberth - Shankhadeep Dey @Iamshankhadeep - Sharikzama @ZamaSharik +- Shrashti @Shrashti1234 - Shrijal Acharya @OctoPie23 - Shivam Chauhan @chashiv - Shivam Sandbhor @sbs2001 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index abc3ae41ad2..96be589abdd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,9 @@ Changelog Next release -------------- +- Install the locally built commoncode wheel on Windows without hardcoding + its version, and fail if building or installing that wheel fails. + - Fix the optional ``licenses`` extra dependency typo to install ``licensedcode-data``. https://github.com/aboutcode-org/scancode-toolkit/pull/5056 diff --git a/configure.bat b/configure.bat index f64e2984bb9..b4218987923 100644 --- a/configure.bat +++ b/configure.bat @@ -163,7 +163,23 @@ if %ERRORLEVEL% neq 0 ( %FLOT_REQUIREMENTS% "%CFG_BIN_DIR%\flot" --pyproject pyproject-commoncode.toml -"%CFG_BIN_DIR%\pip" install --force-reinstall ./dist/commoncode-32.5.2-py3-none-any.whl +if errorlevel 1 exit /b 1 + +@rem # Discover the local wheel without pinning its filename to a release. +set "COMMONCODE_WHEEL=" +set "COMMONCODE_WHEEL_COUNT=0" +for %%W in ("%CFG_ROOT_DIR%\dist\commoncode-*.whl") do ( + if exist "%%W" ( + set /a COMMONCODE_WHEEL_COUNT+=1 >nul + set "COMMONCODE_WHEEL=%%~fW" + ) +) +if not "%COMMONCODE_WHEEL_COUNT%"=="1" ( + echo ERROR: Expected one local commoncode wheel in dist. Remove stale wheels and retry. + exit /b 1 +) +"%CFG_BIN_DIR%\pip" install --force-reinstall "%COMMONCODE_WHEEL%" +if errorlevel 1 exit /b 1 "%CFG_BIN_DIR%\pip" install ^ --upgrade ^