Allow building with cmake on Windows#2090
Open
gabrieljreed wants to merge 4 commits intoAcademySoftwareFoundation:mainfrom
Open
Allow building with cmake on Windows#2090gabrieljreed wants to merge 4 commits intoAcademySoftwareFoundation:mainfrom
gabrieljreed wants to merge 4 commits intoAcademySoftwareFoundation:mainfrom
Conversation
- Introduced `non_pathed_env_vars` configuration to exclude specific variables from path normalization - Updated `_is_pathed_key` method to respect the new configuration - Added tests to verify behavior of non-pathed environment variables in Windows shell Signed-off-by: Gabriel Reed <[email protected]>
Signed-off-by: Gabriel Reed <[email protected]>
Signed-off-by: Gabriel Reed <[email protected]>
Signed-off-by: Gabriel Reed <[email protected]>
a548e19 to
ce9ff60
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1321
Premise
Path normalization
On Windows, rez applies path normalization (converting forward slashes to back slashes) to any environment variable whose name matches the pattern in the
pathed_env_varsconfig setting, which defaults to*PATH. This is correct behavior for variables likePATH,PYTHONPATH, andLD_LIBRARY_PATH, which need native Windows path separators. However,CMAKE_MODULE_PATHalso matches*PATH, but Cmake requires forward slashes in this variable.Unterminated string literal in
rez_install_pythonWhen building rez packages on Windows that use
rez_install_python(withnmake), the build fails with a PythonSyntaxError: unterminated string literalThe root cause is in
InstallPython.cmake- theadd_custom_commandthat compiles.pyfiles into.pycuses single quotes around the Python-cargument.On Unix, make dispatches commands via
/bin/shwhere single quotes are valid string delimiters. On Windows,nmakedispatches viacmd.exe, where single quotes are literal characters, so Python receives'importas the start of an unterminated string literal.Changes
non_pathed_env_vars, which is an exclusion list that takes priority overpathed_env_vars.pathed_env_varsfnmatchwildcards aspathed_env_varsCMAKE_MODULE_PATHout of the box, since this is a known case where we don't want normalizationinstall_pythonmacro-cargumentVERBATIMkeyword toadd_custom_commandso Cmake handles all platform-specific argument quoting correctlyTests
hello_worldexample package on both Windows and Linux after settingbuild_system = "cmake"ActionInterpreter._is_pathed_keyandshell.set_envrez_install_pythoncmake macro, but I verified that it worked manually