-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add (de)activate to --help command list #13191
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
Conversation
We require contributors to sign our Contributor License Agreement and we don't have one on file for @13rac1. In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature, merge the PR (conda/infrastructure#831), and ping the bot to refresh the PR. |
FYI I have signed the CLA |
@conda-bot check |
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.
Hi @13rac1 , thank you so much for creating this PR!
Something that needs to be addressed before this can be merged is that if someone has conda installed but conda init
hasn't been run (you can run $ unset conda
to recreate this scenario), then a very confusing error pops up and conda doesn't get properly activated:
> unset conda
> conda activate
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/Users/biancahenderson/Documents/GitHub/conda/conda/exception_handler.py", line 17, in __call__
return func(*args, **kwargs)
File "/Users/biancahenderson/Documents/GitHub/conda/conda/cli/main.py", line 83, in main_subshell
exit_code = do_call(args, parser)
File "/Users/biancahenderson/Documents/GitHub/conda/conda/cli/conda_argparse.py", line 159, in do_call
relative_mod, func_name = args.func.rsplit(".", 1)
AttributeError: 'Namespace' object has no attribute 'func'
In order to avoid this, a dummy/mock "execute" function for both activate
and deactivate
should be added, most likely in /conda/conda/cli/conda_argparse.py
, with instructions for the user to run conda init
in order to improve the user experience and avoid possible confusion.
You're welcome! Haha, it's never easy is it? These mock execute functions cannot go in conda/conda/cli/conda_argparse.py Lines 155 to 164 in f709c96
I could hack something into |
Make this command return a nonzero shell error code. |
@dholth That is a good point! |
Fixes #6353 |
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.
Thank you for this contribution, @13rac1 !
You're welcome. Thanks! @beeankha @kenodegard @dholth |
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.
Thanks for this pull request! I just have a couple of recommendations that I would like to see added before I give my approval. Please let me know if you have any questions.
@travishathaway No questions, makes sense. This is the difference in output: # before
(base) test_user@f00a24b80e33:/opt/conda-src$ conda activate
ERROR: Run 'conda init' before 'conda activate'
(base) test_user@f00a24b80e33:/opt/conda-src$
#after
(base) test_user@f00a24b80e33:/opt/conda-src$ conda activate
CondaError: Run 'conda init' before 'conda activate'
(base) test_user@f00a24b80e33:/opt/conda-src$ |
Add two mock entries to the `configure_parser_init()` so the `activate` and `deactivate` shell commands are displayed in the --help. Fixes #6353
Adds mock implementations of the activate and deactivate shell commands which run only when conda has not been initialized.
Co-authored-by: Travis Hathaway <travis.j.hathaway@gmail.com>
|
Description
Add two mock entries to the configure_parser_init() so the
activate
anddeactivate
shell commands are displayed in the --help.Before:
After:
This is arguably a hack, but is the correct way to resolve the issue according to #6353. I'm not 100% if they should be listed in
BUILTIN_COMMANDS
, but it seems right to me.Checklist - did you ...
news
directory (using the template) for the next release's release notes?