conan: [bug] activate.sh/deactivate.sh does not work in cygwin
Environment Details (include every applicable attribute)
- Operating System+version: Windows 10 Enterprise Ver 10.0 Build 17763
- Conan version: 1.22.2
- Python version: 3.7.6
- Cygwin DLL version info: DLL version: 3.0.7 DLL epoch: 19 DLL old termios: 5 DLL malloc env: 28 Cygwin conv: 181 API major: 0 API minor: 338 Shared data: 5 DLL identifier: cygwin1 Mount registry: 3 Cygwin registry name: Cygwin Installations name: Installations Cygdrive default prefix: Build date: Shared id: cygwin1S5
Steps to reproduce
- Open cygwin
- Create an empty directory
- In that directory I’ve created a
conanfile.txt
with the following content (the package is a simple helloworld.exe to check if the PATH is properly set):[build_requires] helloworld/1.0.0@conti_gen_dev1/testing [generators] virtualenv
- Run
conan install .
- This will generate the following files which might be used in cygwin:
- activate.sh:
#!/usr/bin/env sh export CONAN_OLD_PATH="$PATH" while read -r line; do LINE="$(eval echo $line)"; export "$LINE"; done < "D:\casdev\_test\conan_poc\conan_test_shell\environment.sh.env" export CONAN_OLD_PS1="$PS1" export PS1="(conanenv) $PS1"
- deactivate.sh:
!/usr/bin/env sh export PS1="$CONAN_OLD_PS1" unset CONAN_OLD_PS1 export PATH="$CONAN_OLD_PATH" unset CONAN_OLD_PATH
- environment.sh.env:
PATH="D:\.conan\614de7\1\bin"${PATH+:$PATH}
- activate.sh:
- Now in Cygwin when calling
source activate.sh
the following errors are displayed:-bash: $'\r': command not found -bash: activate.sh: line 7: syntax error near unexpected token `done' 'bash: activate.sh: line 7: `done < "D:\casdev\_test\conan_poc\conan_test_shell\environment.sh.env"
- Similar problem exists for
source deactivate.sh
Notes
- If I call
source activate.sh
in a Git Bash then it works fine, so it seems to be a problem only for cygwin - If I modify the line endings in
activate.sh
anddeactivate.sh
from CR LF to LF then it also works in cygwin - See also issue #2568
Proposal
activate.sh
anddeactivate.sh
should always use LF as line endings independent of the OS- This should work in Git Bash, cygwin, Linux
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (11 by maintainers)
@jgsogo We’ve stored different Cygwin version as conan tool packages in our Artifactory 😁 Only for the latest version (3.0.7) I’ve used an installer. For Cygwin 2.9.0 you might check https://bintray.com/bincrafters/public-conan/cygwin_installer%3Abincrafters, but I haven’t tested it.
I’m not sure, but maybe it’s also important how conan has been installed:
pip install conan
into the native Windows Python. This will create the conan.exe in linked to the native Windows Python. Then when calling conan inside of cygwin it would call the Windows native Python (this is how we have done)=> So conan might behave different when e.g. checking the OS. Below both commands are executed from within the Cygwin shell. The “python3” is the Python coming with Cygwin, but the second Python is the Windows native installation: