Open datalogics-kam opened 2 years ago
Hi @datalogics-kam
But for user side, you can easily have the one that you want, because you can do:
$ conan install ....
$ conan install ... -c tools.env.virtualenv:powershell=True # or False, depending on your default
That is, the CLI always has priority, and can override. conan install
will be fast once things are installed.
We are trying to avoid the definition of multiple files by Conan, because the automatic activation of those files is based on the files existence itself. So generating both .bat and .ps1 will result in an error by any Conan method that tries to apply the environment. Does this make sense?
I see...I installed our project that uses conan.tools
with -c tools.env.virtualenv:powershell=True
, on Conan 1.49.
A few things happened:
.bat
files anyway. I didn't expect that.conan build
failed, and I see the warning about wrapping the command with different envs.conan.tools.microsoft.VCVars
. That would be nice.I'm curious...doesn't Conan know what shell it's going to use to run a command? On Windows, isn't it CMD, unless something specified win_bash
?
A potential situation for us is that the user is using PowerShell for manual building, but Conan is using CMD to run the commands. Unless there's something to make Conan use PowerShell, that I missed.
(I removed things that reveal what product I'm working on)
> conan build . -if .\build\x64\Debug\
Using lockfile: 'C:\Users\kam\src\...\x64\Debug/conan.lock'
Using cached profile from lockfile
conanfile.py (DevTests/1.0.0): Calling build()
conanfile.py (DevTests/1.0.0): CMake command: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="C:/Users/kam/src/.../build/x64/Debug/conan/conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "C:\Users\kam\src\..."
ERROR: conanfile.py (product/1.0.0): Error in build() method, line 273
cmake.configure()
ConanException: Cannot wrap command with different envs, ['C:\\Users\\kam\\src\\pdfl18_all\\.../x64/Debug\\conan\\conanbuild.bat'] - [] - ['C:\\Users\\kam\\src\\...\\build/x64/Debug\\conan\\conanbuild.ps1']
It would be handy to have a way
tools.env.virtualenv:powershell
to create both.ps1
and.bat
files..ps1
to activate within a user's interactive PowerShell if necessary..bat
for when build scripting is using CMD to issue commands, and it needs to activate the environment to run CMake or some other command.[x] I've read the CONTRIBUTING guide.
This came out of using
conan.tools
to make a Conan 2.0-ish workflow while using Conan 1.