Checklist
What happened?
When building a recipe whose package name is conda on Windows, conda-build does not write activation into build_env_setup.bat. Host etc/conda/activate.d scripts therefore never run during the build.
Unix has no equivalent skip: activate_build_script still writes shell activation (including _CONDA_BUILD_ISOLATED_ACTIVATION via python -I -m conda shell.bash hook).
Observed impact: conda canary builds on Windows ship mismatched versions — conda list shows the recipe/PKG_VERSION string, while conda --version / conda.__version__ come from hatch-vcs/git because defaults setuptools-scm never gets to set SETUPTOOLS_SCM_PRETEND_VERSION=%PKG_VERSION%. Linux canaries match. Tracked downstream as conda/conda#16460.
Root cause: in conda_build/windows.py:
if m.config.activate and m.name() != "conda":
write_bat_activation_text(fo, m)
Historical reason was #2381 (avoid creating symlinks/.bat files when building conda). Unix later gained isolated activation for packaging conda; Windows build activation still hard-skips and never consults _CONDA_BUILD_ISOLATED_ACTIVATION.
Expected: With activation enabled (and especially with _CONDA_BUILD_ISOLATED_ACTIVATION=1), Windows should activate host/build envs when packaging conda the same way Unix does, so activate.d scripts run.
Conda Info
N/A (packaging bug in conda-build; reproduced in conda canary CI)
Conda Config
N/A
Conda list
N/A
Additional Context
- Repro CI: https://github.com/conda/conda/actions/runs/30258767626 (win-64 vs linux-64)
- Linux log:
conda package setuptools_scm activate script: setting SETUPTOOLS_SCM_PRETEND_VERSION=26.7.0.129+g397bbb548 when CONDA_BUILD=1
- Windows log:
CONDA_BUILD=1 and PKG_VERSION=… are set, but that activate echo never appears; pip installs conda-26.5.4.dev129 while the conda package is 26.7.0.129+g397bbb548
- Related code:
- Skip:
conda_build/windows.py (name() != "conda")
- Unix activation (no name skip):
conda_build/build.py write_build_scripts / _write_sh_activation_text
- Windows activation writer (no isolated-activation wiring):
conda_build/utils.py write_bat_activation_text
- Suggested direction: allow activation when packaging
conda under isolated activation; wire _CONDA_BUILD_ISOLATED_ACTIVATION into write_bat_activation_text; add a Windows test for a recipe named conda that asserts a host activate.d env var is visible in the build.
Checklist
What happened?
When building a recipe whose package name is
condaon Windows, conda-build does not write activation intobuild_env_setup.bat. Hostetc/conda/activate.dscripts therefore never run during the build.Unix has no equivalent skip:
activate_build_scriptstill writes shell activation (including_CONDA_BUILD_ISOLATED_ACTIVATIONviapython -I -m conda shell.bash hook).Observed impact: conda canary builds on Windows ship mismatched versions —
conda listshows the recipe/PKG_VERSIONstring, whileconda --version/conda.__version__come from hatch-vcs/git because defaultssetuptools-scmnever gets to setSETUPTOOLS_SCM_PRETEND_VERSION=%PKG_VERSION%. Linux canaries match. Tracked downstream as conda/conda#16460.Root cause: in
conda_build/windows.py:Historical reason was #2381 (avoid creating symlinks/
.batfiles when building conda). Unix later gained isolated activation for packaging conda; Windows build activation still hard-skips and never consults_CONDA_BUILD_ISOLATED_ACTIVATION.Expected: With activation enabled (and especially with
_CONDA_BUILD_ISOLATED_ACTIVATION=1), Windows should activate host/build envs when packagingcondathe same way Unix does, soactivate.dscripts run.Conda Info
N/A (packaging bug in conda-build; reproduced in conda canary CI)
Conda Config
N/A
Conda list
N/A
Additional Context
conda package setuptools_scm activate script: setting SETUPTOOLS_SCM_PRETEND_VERSION=26.7.0.129+g397bbb548 when CONDA_BUILD=1CONDA_BUILD=1andPKG_VERSION=…are set, but that activate echo never appears; pip installsconda-26.5.4.dev129while the conda package is26.7.0.129+g397bbb548conda_build/windows.py(name() != "conda")conda_build/build.pywrite_build_scripts/_write_sh_activation_textconda_build/utils.pywrite_bat_activation_textcondaunder isolated activation; wire_CONDA_BUILD_ISOLATED_ACTIVATIONintowrite_bat_activation_text; add a Windows test for a recipe namedcondathat asserts a hostactivate.denv var is visible in the build.