Skip to content

Expose uninstallation options as environment variables#1197

Merged
marcoesters merged 6 commits intoconda:mainfrom
marcoesters:expose-uninstallation-variables
Apr 6, 2026
Merged

Expose uninstallation options as environment variables#1197
marcoesters merged 6 commits intoconda:mainfrom
marcoesters:expose-uninstallation-variables

Conversation

@marcoesters
Copy link
Copy Markdown
Contributor

Description

Expose uninstallation options as environment variables for EXE installers. This is useful for when packages write into locations outside of the installation directory and outside directories associated with conda (e.g., the %USERPROFILE%\.anaconda directory). Exposing these environment variables allows for pre-uninstall scripts to clean up these directories.

Currently only implemented for EXE installers since they are the only installers that allow pre-uninstall scripts.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@github-project-automation github-project-automation bot moved this to 🆕 New in 🔎 Review Apr 3, 2026
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Apr 3, 2026
@marcoesters marcoesters marked this pull request as ready for review April 5, 2026 14:27
@marcoesters marcoesters requested a review from a team as a code owner April 5, 2026 14:27
Copy link
Copy Markdown
Contributor

@lrandersson lrandersson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, should we document that these environment variables exist? Perhaps we can do this separately when the MSI work is merged because they will exist but with different names. With that being said, I wonder if we should name these options with a similar pattern as in the MSI scenario:

>> "%LOG%" echo OPTION_REMOVE_USER_DATA=%OPTION_REMOVE_USER_DATA%

@marcoesters
Copy link
Copy Markdown
Contributor Author

Looks good, should we document that these environment variables exist? Perhaps we can do this separately when the MSI work is merged because they will exist but with different names. With that being said, I wonder if we should name these options with a similar pattern as in the MSI scenario:

>> "%LOG%" echo OPTION_REMOVE_USER_DATA=%OPTION_REMOVE_USER_DATA%

They should have the same name for simplicity. I personally prefer the UNINSTALLER_* because it shows the scope of the variables. I added them to the documentation.

@marcoesters marcoesters requested a review from lrandersson April 6, 2026 14:46
@lrandersson
Copy link
Copy Markdown
Contributor

Looks good, should we document that these environment variables exist? Perhaps we can do this separately when the MSI work is merged because they will exist but with different names. With that being said, I wonder if we should name these options with a similar pattern as in the MSI scenario:

>> "%LOG%" echo OPTION_REMOVE_USER_DATA=%OPTION_REMOVE_USER_DATA%

They should have the same name for simplicity. I personally prefer the UNINSTALLER_* because it shows the scope of the variables. I added them to the documentation.

I agree with that, unfortunately the naming pattern is part of briefcase and not something we can modify within constructor.

@marcoesters
Copy link
Copy Markdown
Contributor Author

Looks good, should we document that these environment variables exist? Perhaps we can do this separately when the MSI work is merged because they will exist but with different names. With that being said, I wonder if we should name these options with a similar pattern as in the MSI scenario:

>> "%LOG%" echo OPTION_REMOVE_USER_DATA=%OPTION_REMOVE_USER_DATA%

They should have the same name for simplicity. I personally prefer the UNINSTALLER_* because it shows the scope of the variables. I added them to the documentation.

I agree with that, unfortunately the naming pattern is part of briefcase and not something we can modify within constructor.

Then we have two options: call the variables the same in NSIS as they are in briefcase, or set UNINSTALLER_REMOVE_CACHES=%OPTION_REMOVE_CACHES%. I think the latter is actually needed because of --remove-config-files:

if "%OPTION_REMOVE_CONFIG_FILES%"=="1" (
rem User installs (.nonadmin marker exists) only remove user config files.
rem Admin installs remove both user and system config files.
if exist "%BASE_PATH%\.nonadmin" (
set "UNINST_ARGS=!UNINST_ARGS! --remove-config-files=user"
) else (
set "UNINST_ARGS=!UNINST_ARGS! --remove-config-files=all"
)
)

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Approved in 🔎 Review Apr 6, 2026
@marcoesters marcoesters merged commit 5d0f80f into conda:main Apr 6, 2026
18 of 19 checks passed
@github-project-automation github-project-automation bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Apr 6, 2026
@marcoesters marcoesters deleted the expose-uninstallation-variables branch April 6, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Status: 🏁 Done

Development

Successfully merging this pull request may close these issues.

3 participants