Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

Private environment variables in shims

Open excitoon opened this issue 6 years ago • 10 comments

Hi.

I'd like to suggest a feature - possibility to specify environment variables right in shim. It will allow to not pollute system variables with application-specific data and make ideally isolated application packages.

For example, I wish to install Python 2.7 and allow user to use his own Python installation as well (many packages like Anaconda, MSVC, Jupyter install Python as part of itself). In this case, I make following shims:

pip2.shim:

path = C:\Users\Chebotarev_V\scoop\apps\python27\current\python.exe
args = -m pip
env::PYTHONHOME = C:\Users\Chebotarev_V\scoop\apps\python27\current\

python2.shim:

path = C:\Users\Chebotarev_V\scoop\apps\python27\current\python.exe
env::PYTHONHOME = C:\Users\Chebotarev_V\scoop\apps\python27\current\

And depending on executable I call, my packages will be kept completely intact by foreign Python. I can install two versions of Python to the same user and be sure everything is fine.

I hope you get the idea, some applications can have non-compatible requirements for environment variables and this patch enables possibility to use them.

Suggestions are welcome.

excitoon avatar Dec 20 '18 11:12 excitoon

One more example (and test shim):

path = python3
args = -c "import os; print(os.environ)"
env::Path = my_custom_path;%Path%

excitoon avatar Dec 20 '18 11:12 excitoon

Also, I want to note, that shim is a critical piece of Scoop. I guess we should have tests somewhere in separate PR.

excitoon avatar Dec 20 '18 11:12 excitoon

Also my patch will allow to fix this #2693 .

excitoon avatar Dec 20 '18 12:12 excitoon

@r15ch13 Please, let's make JSON in separate PR if needed.

excitoon avatar Dec 20 '18 19:12 excitoon

By the way, currently perl package pollutes PATH in very bad way, overriding default gcc.

excitoon avatar Dec 25 '18 15:12 excitoon

Hi @r15ch13. Is there anything that prevents us from merging it? I can see that people react in good way about this change.

excitoon avatar Feb 21 '19 11:02 excitoon

This requires changes to shim() to function.

r15ch13 avatar Feb 24 '19 13:02 r15ch13

Hi, I came to bascially ask for this exact feature, are there any reason this wasn't merged?

melMass avatar Sep 15 '23 18:09 melMass

The shim code in this PR is no longer used

rashil2000 avatar Sep 17 '23 20:09 rashil2000

Probably not ideal but I overcome my needs by making a "bin wrapper" to use in manifests

melMass avatar Sep 17 '23 21:09 melMass