conda-forge / dotnet-feedstock

A conda-smithy repository for dotnet.
BSD 3-Clause "New" or "Revised" License
4 stars 5 forks source link

ps1 activate/deactivate scripts broken on linux #49

Closed FaustinCarter closed 2 years ago

FaustinCarter commented 2 years ago

Issue:

When installing the dotnet package on a linux machine using pwsh the activation script adds the wrong path to $PATH. This is because the ps1 activation script assumes the user is on Windows instead of testing for operating system.

One possible fix is to test for OS like:

if ([System.Environment]::OSVersion.Platform -eq "Unix") { $env:DOTNET_ROOT=...} else { $env:DOTNET_ROOT=...}
acesnik commented 2 years ago

Hi @FaustinCarter,

I'm not sure I understand the issue or suggested fix here. Is the problem in regards to the format of the path, i.e. using windows-formatted instead of unix-formatted paths? If that's so, I'm not sure why that would be, since the script is using Join-Paths instead of doing a hard-coded join. https://github.com/conda-forge/dotnet-feedstock/blob/master/recipe/activate.d/dotnet-root.ps1

Please feel free to make a minimal pull request where you think it would help, and I can incorporate that into a polished pull request (rerendering conda and such), if that would help.

Anthony

FaustinCarter commented 2 years ago

Hi @acesnik, if you look at the $DOTNET_ROOT variable in the bash activate script you’ll see it is different than the one in the batch and powershell scripts. Since powershell is supported on Linux that variable should be set based on detected OS so that dotnet is available on the path when using powershell on Linux.

acesnik commented 2 years ago

Oh, I think I'm understanding this more. Is this all because DOTNET_ROOT is PREFIX/lib/dotnet on unix and PREFIX/dotnet on Windows? I made this pull request: https://github.com/conda-forge/dotnet-feedstock/pull/52/files#diff-be8e5a14c87c47e1c2d445d95529f917f5baad50b58064e8ab7144393ba7ce77R4. Is this what you're looking for?

FaustinCarter commented 2 years ago

That looks like it should fix it!