From 2c1232ca8e7497894528a719eafc12ec86cd76a2 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 31 Aug 2025 16:54:31 +1100 Subject: [PATCH 1/2] Reapply "Merge pull request #95 from h-vetinari/reactivate" This reverts commit 4f9e21e419d033c2be327139017808b79dfec631. --- recipe/activate.bat | 22 ++++++++++++++++++++++ recipe/deactivate.bat | 17 +++++++++++++++++ recipe/vc_repack.py | 6 ++++++ 3 files changed, 45 insertions(+) create mode 100644 recipe/deactivate.bat diff --git a/recipe/activate.bat b/recipe/activate.bat index 97eeba0..359023a 100755 --- a/recipe/activate.bat +++ b/recipe/activate.bat @@ -1,3 +1,18 @@ +@@echo off +setlocal enabledelayedexpansion + +:: save existing variables for deactivation script +for %%X in ( + CC CXX CMAKE_ARGS CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET + CMAKE_PREFIX_PATH CONDA_BUILD_CROSS_COMPILATION DISTUTILS_USE_SDK INCLUDE + LIB MSSdk MSYS2_ARG_CONV_EXCL MSYS2_ENV_CONV_EXCL PY_VCRUNTIME_REDIST + VCVARSBAT VS_MAJOR VS_VERSION VS_YEAR VSINSTALLDIR WindowsSDKVer +) do ( + if defined %%X ( + set "_CONDA_BACKUP_%%X=!%%X!" + ) +) + @@echo on :: Set env vars that tell distutils to use the compiler that we put on path @@ -186,6 +201,13 @@ IF NOT "@{target_platform}" == "@{host_platform}" ( set "CONDA_BUILD_CROSS_COMPILATION=0" ) +:: unset auxiliary variables +set "CMAKE_GEN=" +set "CMAKE_PLAT=" +set "LATEST_VS=" +set "NEWER_VS_WITH_OLDER_VC=" +set "USE_NEW_CMAKE_GEN_SYNTAX=" + :GetWin10SdkDir call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node > nul 2>&1 if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE\Wow6432Node > nul 2>&1 diff --git a/recipe/deactivate.bat b/recipe/deactivate.bat new file mode 100644 index 0000000..1dfee83 --- /dev/null +++ b/recipe/deactivate.bat @@ -0,0 +1,17 @@ +@@echo off +setlocal enabledelayedexpansion + +:: restore variables +for %%X in ( + CC CXX CMAKE_ARGS CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET + CMAKE_PREFIX_PATH CONDA_BUILD_CROSS_COMPILATION DISTUTILS_USE_SDK INCLUDE + LIB MSSdk MSYS2_ARG_CONV_EXCL MSYS2_ENV_CONV_EXCL PY_VCRUNTIME_REDIST + VCVARSBAT VS_MAJOR VS_VERSION VS_YEAR VSINSTALLDIR WindowsSDKVer +) do ( + if defined _CONDA_BACKUP_%%X ( + set "%%X=!_CONDA_BACKUP_%%X!" + set "_CONDA_BACKUP_%%X=" + ) else ( + set "%%X=" + ) +) diff --git a/recipe/vc_repack.py b/recipe/vc_repack.py index 18fe39b..ba093a4 100644 --- a/recipe/vc_repack.py +++ b/recipe/vc_repack.py @@ -429,6 +429,12 @@ def main(): ) as w: for line in r: w.write(subs(line, args)) + targetdir = os.path.join(env.prefix, "etc", "conda", "deactivate.d") + os.makedirs(targetdir) + shutil.copyfile( + os.path.join(env.recipe_dir, "deactivate.bat"), + os.path.join(targetdir, f"vs{args.activate_year}_compiler_vars.bat"), + ) targetdir = os.path.join(env.prefix, "etc", "conda-build", "dsolists.d") os.makedirs(targetdir) # Implement CEP-28 From 9a2f5afbd06f882ed9fdff7469dfe6d1732b29bd Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 2 Jan 2026 14:42:43 +1100 Subject: [PATCH 2/2] add downstream tests to guard against previously seen breakage from deactivation --- recipe/meta.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 1f6d4eb..bb8712c 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -270,6 +270,11 @@ outputs: - echo "%CMAKE_GENERATOR%" - echo "%CMAKE_GENERATOR_PLATFORM%" - echo "%CMAKE_GENERATOR_TOOLSET%" + # compare https://github.com/conda-forge/vc-feedstock/issues/94 + downstreams: # [win] + - clang_win-64 # [win] + - clangxx_win-64 # [win] + - clang-cl_win-64 # [win] about: summary: >- Activation and version verification of MSVC {{ vcver }}