-
Notifications
You must be signed in to change notification settings - Fork 169
Add support for conda init --condabin
, which adds condabin/
to PATH
#965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…o pydantic-schema
constructor/header.sh
Outdated
@@ -675,9 +694,66 @@ if [ "${PYTHONPATH:-}" != "" ]; then | |||
printf " directories of packages that are compatible with the Python interpreter\\n" | |||
printf " in %s: %s\\n" "${INSTALLER_NAME}" "$PREFIX" | |||
fi | |||
{% if has_conda %} | |||
{%- if initialize_conda == 'condabin'%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{%- if initialize_conda == 'condabin'%} | |
{%- if initialize_conda == 'condabin' %} |
tests/test_examples.py
Outdated
input_path = _example_path("condabin") | ||
for installer, install_dir in create_installer(input_path, tmp_path): | ||
if installer.suffix == ".exe": | ||
options = ["/AddToPath=1"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test is failing on Windows because you're admin on GitHub runner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid that's true. I'm looking at options to run as a different user but they are really hacky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried my best as you can see in all the commits underneath, but there seems to be a permissions issue to run pytest
from the non-admin account. That said, I checked on the VM and:
- The test doesnt' pass there either
- BUT the PATH environment var modification can be seen in the Control Panel dialog.
- The assertion does pass in a new terminal window
I tried several ways to start a fresh process (subprocess
flags, os.startfile
...), and no luck.
I did check locally that the PATH is indeed modified, so it works, but it can't be tested on CI :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it looks like you essentially have to restart your shell and environment variables do not propagate into the child processes pytest
starts. Does checking the registry work on your local system?
If so, I have the following suggestion that actually checks two things at once:
- Check if user is an admin via
ctypes.windll.shell32.IsUserAnAdmin()
- Force the installation to use
/InstallationType=JustMe
. - If the user is an admin, mark the test as
xfail
. This will also check whether the CVE that disables adding to path with an admin installation has been re-introduced. - Parametrize the test to check for both
classic
andcondabin
- I don't think there is a test for that yet.
Co-authored-by: Marco Esters <mesters@anaconda.com>
Description
Closes #960.
Based on #943 to avoid conflicts down the line because this adds new options to
construct.yaml
. Excuse the diff while 943 gets reviewed.Windows:
macOS:
Checklist - did you ...
news
directory (using the template) for the next release's release notes?