question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] The new VirtualRunEnv never clean the deactivate script (it should use a temp deactivate file)

See original GitHub issue

Environment Details

  • Operating System+version: Linux (archlinux)
  • Conan version: 1.47.0
  • Python version: 3.9

Steps to reproduce (Include if Applicable)

conanfile.txt:

[requires]
fmt/8.0.0
# testing only deps below
doctest/2.4.6

[generators]
CMakeToolchain
CMakeDeps
VirtualRunEnv
$ conan install . --install-folder=.conanvirtualenv --build=missing --profile:build=default
$ source .conanvirtualenv/conanrun.sh
Capturing current environment in .conanvirtualenv/deactivate_conanrunenv-release-x86_64.sh
Configuring environment variables
$ source .conanvirtualenv/deactivate_conanrun.sh
Restoring environment
$ source .conanvirtualenv/conanrun.sh
Capturing current environment in .conanvirtualenv/deactivate_conanrunenv-release-x86_64.sh
Configuring environment variables
$ source .conanvirtualenv/deactivate_conanrun.sh
Restoring environment
Restoring environment

Explanation of the issue

The issue here is, the more we do activate/deactivate the more the string “Restoring environment” will be displayed (and after a while it can be very annoying on my shell) and the more the script deactivate_conanrunenv-release-x86_64.sh will be full. When using the VirtualRunEnv I found that very annoying after a while. I would recommend that:

  • the activate script create a temp deactivate file with mktemp
  • stores the place of the deactivate file in the env variable CONAN_DEACTIVATE_FILE
  • source $CONAN_DEACTIVATE_FILE in the non temp deactivate script.

I could do a PR for linux with that, but since I don’t know how to do that on Windows (I don’t have Windows installed at all) I think my PR won’t be accepted.

@memsharded @lasote @czoido: I think you guys are the one working on this recently (so I hope it is okay to highlight you), what do you think?

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
CPickens42commented, Apr 7, 2022

I understand completely. To be honest I thought that conan 2.0 would be out in a few month at least. I will do a PR when I’ll have the time on my own (not until few weeks). I think doing it is mandatory on the long run to have a proper experience of conan.

0reactions
memshardedcommented, Apr 7, 2022

Ok, thanks very much for the detailed explanation.

Now I understand the issue, I thought we were talking about multiple sequential activation & deactivation of environments. I see that we are talking about concurrent usage of these environment scripts, and it is completely true that the current approach is not designed to support it.

I agree that learning from Python virtualenvs and improving the current approach is the way to go. The only thing is that this will not be a priority at the moment as we are focusing on getting 2.0 out. I’d say to try it in the 2.X scope. Contributions are welcome, of course, but they also require time to review and to understand well what is doing (because the truth is that in the long term we need to support, maintain and evolve it).

Read more comments on GitHub >

github_iconTop Results From Across the Web

python 3.x - Unable to activate virtualenv via bash script
The issue is that the activate script has Windows line endings. We can confirm this by running the below command on the command...
Read more >
Is it bad practice not to deactivate a virtual environment ...
No, the only thing that activate/deactivate does it put your virtualenv's Python environment in front of any other environments in the PATH ...
Read more >
How To Set Up a Virtual Python Environment (Windows)
You can read more about it in the Virtualenv documentation. This article provides a quick summary to help you set up and use...
Read more >
pre-commit
Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically...
Read more >
virtualenv 1.8.3
After activating an environment you can use the function deactivate to undo the changes to your $PATH. The activate script will also modify...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found