Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
181519f
Set CONDA_PROTECT_FROZEN_ENVS to 0
Jrice1317 Sep 9, 2025
3ec3015
Implement version check for frozen env
Jrice1317 Sep 9, 2025
1e59d8f
First attempt at testing
Jrice1317 Sep 9, 2025
8150b81
Fix version check
Jrice1317 Sep 11, 2025
7540633
Fix test
Jrice1317 Sep 11, 2025
c43f6bb
Change source in extra files mapping to use empty json
Jrice1317 Sep 15, 2025
bfce427
Only search `extra_files` for frozen file and xfail if version is 25.5.x
Jrice1317 Sep 15, 2025
285d8d8
Handle str and dict instances
Jrice1317 Sep 16, 2025
5ea8513
Add helper function for version ranges
marcoesters Sep 16, 2025
596f10d
Remove stray comma
marcoesters Sep 16, 2025
5d05eac
Merge pull request #1 from Jrice1317/frozen_fork
Jrice1317 Sep 16, 2025
e3b8659
Fix pre-commit errors
Jrice1317 Sep 16, 2025
7509f2a
Merge branch 'protected_envs' into conda-standalone-version-helper
marcoesters Sep 16, 2025
023f815
Invert boolean logic for shortcut check
marcoesters Sep 16, 2025
6ff480e
Merge branch 'conda-standalone-version-helper' of github.com:marcoest…
marcoesters Sep 16, 2025
f4c092e
Merge pull request #2 from marcoesters/conda-standalone-version-helper
Jrice1317 Sep 16, 2025
3255967
Use path for frozen file search
Jrice1317 Sep 16, 2025
0a3acff
Add news file
Jrice1317 Sep 16, 2025
9196951
Merge branch 'main' of https://github.com/conda/constructor into prot…
Jrice1317 Sep 17, 2025
7e758da
Pre-commit fixes
Jrice1317 Sep 17, 2025
adc94a4
Apply suggestions from code review
Jrice1317 Sep 17, 2025
9265135
Apply suggestions from code review
Jrice1317 Sep 18, 2025
c841a22
Fix typo
Jrice1317 Sep 19, 2025
60b87bc
Expand test to test base and extra envs
Jrice1317 Sep 19, 2025
bee6aaf
Fix pre-commit
Jrice1317 Sep 19, 2025
a66bc0c
Merge branch 'main' of https://github.com/conda/constructor into prot…
Jrice1317 Sep 24, 2025
98ba9a4
Apply code suggestions
Jrice1317 Sep 25, 2025
f58bb03
Apply suggestions from code review
Jrice1317 Sep 25, 2025
60cf7ef
Merge branch 'main' into protected_envs
jaimergp Sep 30, 2025
1e1efdf
Merge branch 'main' into protected_envs
marcoesters Sep 30, 2025
d40f731
Merge branch 'main' into protected_envs
marcoesters Sep 30, 2025
5bfd549
Update tests/test_examples.py
marcoesters Oct 1, 2025
dc496d5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 1, 2025
630d022
Swap test_frozen_environment with test_regressions
marcoesters Oct 1, 2025
289cd07
Revert "Update tests/test_examples.py"
marcoesters Oct 1, 2025
84d9326
Remove installation directory after sh installations
marcoesters Oct 1, 2025
1e0b0b0
Add comment to explain finalizer
marcoesters Oct 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ shortcuts=""

{%- set channels = final_channels|join(",") %}
# shellcheck disable=SC2086
CONDA_PROTECT_FROZEN_ENVS="0" \
CONDA_ROOT_PREFIX="$PREFIX" \
CONDA_REGISTER_ENVS="{{ register_envs }}" \
CONDA_SAFETY_CHECKS=disabled \
Expand Down Expand Up @@ -631,6 +632,7 @@ for env_pkgs in "${PREFIX}"/pkgs/envs/*/; do
env_shortcuts=""
{%- endif %}
# shellcheck disable=SC2086
CONDA_PROTECT_FROZEN_ENVS="0" \
CONDA_ROOT_PREFIX="$PREFIX" \
CONDA_REGISTER_ENVS="{{ register_envs }}" \
CONDA_SAFETY_CHECKS=disabled \
Expand Down
6 changes: 6 additions & 0 deletions constructor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ def main_build(
):
sys.exit("Error: uninstalling with conda.exe requires conda-standalone 24.11.0 or newer.")

if (info.get("CONDA_PROTECT_FROZEN_ENVS")
and exe_type == StandaloneExe.CONDA
and exe_version
and exe_version <= Version("25.5.1")):
sys.exit("Error: installing with protected base environment requires conda-standalone newer than 25.5.1.")

logger.debug("conda packages download: %s", info["_download_dir"])

for key in ("welcome_image_text", "header_image_text"):
Expand Down
7 changes: 4 additions & 3 deletions constructor/nsis/main.nsi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1296,11 +1296,12 @@ Section "Install"
{%- endfor %}
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_SAFETY_CHECKS", "disabled").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_EXTRA_SAFETY_CHECKS", "no").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_ROOT_PREFIX", "$INSTDIR")".r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_PKGS_DIRS", "$INSTDIR\pkgs")".r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_ROOT_PREFIX", "$INSTDIR").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_PKGS_DIRS", "$INSTDIR\pkgs").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_PROTECT_FROZEN_ENVS", "0").r0'
# Spinners in conda write a new character with each movement of the spinner.
# For long installation times, this may cause a buffer overflow, crashing the installer.
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_QUIET", "1")".r0'
Comment thread
Jrice1317 marked this conversation as resolved.
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_QUIET", "1").r0'
# Extra info for pre and post install scripts
# NOTE: If more vars are added, make sure to update the examples/scripts tests too
# There's a similar block for the pre_uninstall script, further down this file.
Expand Down
2 changes: 2 additions & 0 deletions constructor/osx/run_installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ fi
notify "Installing packages. This might take a few minutes."
# shellcheck disable=SC2086
if ! \
CONDA_PROTECT_FROZEN_ENVS="0" \
CONDA_REGISTER_ENVS="{{ register_envs }}" \
CONDA_ROOT_PREFIX="$PREFIX" \
CONDA_SAFETY_CHECKS=disabled \
Expand Down Expand Up @@ -93,6 +94,7 @@ for env_pkgs in "${PREFIX}"/pkgs/envs/*/; do
fi

# shellcheck disable=SC2086
CONDA_PROTECT_FROZEN_ENVS="0" \
CONDA_ROOT_PREFIX="$PREFIX" \
CONDA_REGISTER_ENVS="{{ register_envs }}" \
CONDA_SAFETY_CHECKS=disabled \
Expand Down
1 change: 1 addition & 0 deletions examples/protected_base/conda-meta/frozen
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This environment is protected.
Comment thread
Jrice1317 marked this conversation as resolved.
Outdated
22 changes: 22 additions & 0 deletions examples/protected_base/construct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# yaml-language-server: $schema=../../constructor/data/construct.schema.json
"$schema": "../../constructor/data/construct.schema.json"

name: ProtectedBaseEnv
version: X
installer_type: all

channels:
- defaults

specs:
- python
- conda

extra_envs:
default:
specs:
- python
- pip

extra_files:
- frozen.json: conda-meta/frozen
Comment thread
Jrice1317 marked this conversation as resolved.
Outdated
15 changes: 15 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,3 +1370,18 @@ def test_regressions(tmp_path, request):
check_subprocess=True,
uninstall=True,
)

def test_frozen_environment(tmp_path, request):
input_path = _example_path("protected_base")
for installer, install_dir in create_installer(input_path, tmp_path):
frozen_file = install_dir / "conda-meta" / "frozen"
assert frozen_file.exists()
_run_installer(
input_path,
installer,
install_dir,
request=request,
check_subprocess=True,
uninstall=True
)
assert frozen_file.exists()
Loading