-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find system ruby 3.2 #5158
Find system ruby 3.2 #5158
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is:
- Outdated
- Already preset in CMake itself
- Not going to be used, becasue conan2 places a FindRuby.cmake in our build dir
|
||
# **NOTE**: we do not want to grab the conan one, which is statically built on all platforms, and is a msvc build on windows | ||
# Instead, we want to grab the regularly installed one on your system | ||
|
||
set(_RUBY_POSSIBLE_EXECUTABLE_NAMES | ||
ruby | ||
ruby2.7 | ||
ruby2.7.2 | ||
ruby27 | ||
ruby272) | ||
ruby3.2 | ||
ruby3.2.2 | ||
ruby32 | ||
ruby322 | ||
) | ||
|
||
# TODO: this isn't great but I haven't found a better way to locate the system ruby (and avoid the one in build/Ruby-install/) | ||
# TODO: this isn't great but I haven't found a better way to locate the system ruby (and avoid the conan one) | ||
find_program(SYSTEM_RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} | ||
HINTS | ||
"/usr/local/rvm/rubies/ruby-2.7.2/bin/" | ||
"/usr/local/rvm/rubies/ruby-2.7.2/bin/ruby" | ||
"/usr/share/rvm/rubies/ruby-2.7.2/bin/" | ||
"$ENV{HOME}/.rvm/rubies/ruby-2.7.2/bin/" | ||
"/usr/local/rvm/rubies/ruby-3.2.2/bin/" | ||
"/usr/local/rvm/rubies/ruby-3.2.2/bin/ruby" | ||
"/usr/share/rvm/rubies/ruby-3.2.2/bin/" | ||
"$ENV{HOME}/.rvm/rubies/ruby-3.2.2/bin/" | ||
|
||
"C:/Ruby27-x64/bin/" | ||
"C:/Ruby32-x64/bin/" | ||
|
||
"/usr/local/ruby272/bin/" | ||
"/usr/local/ruby27/bin/" | ||
"/usr/local/ruby322/bin/" | ||
"/usr/local/ruby32/bin/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized CMake was happily picking my rvm ruby 2.7 because of this, so update the hints (and code comments)
if(SYSTEM_RUBY_EXECUTABLE) | ||
# Validate the version | ||
execute_process (COMMAND "${SYSTEM_RUBY_EXECUTABLE}" -e "puts RUBY_VERSION" | ||
RESULT_VARIABLE _result | ||
OUTPUT_VARIABLE _system_ruby_version | ||
ERROR_QUIET | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
if(_result OR (_system_ruby_version VERSION_LESS 3.2) OR (_system_ruby_version VERSION_GREATER_EQUAL 3.3)) | ||
if(_result) | ||
message(WARNING "Cannot use the interpreter \"${SYSTEM_RUBY_EXECUTABLE}\"") | ||
else() | ||
message(WARNING "Wrong version \"${_system_ruby_version}\" for the interpreter \"${SYSTEM_RUBY_EXECUTABLE}\", not >= 3.2 < 3.3") | ||
endif() | ||
set_property (CACHE SYSTEM_RUBY_EXECUTABLE PROPERTY VALUE "SYSTEM_RUBY_EXECUTABLE-NOTFOUND") | ||
else() | ||
message(STATUS "Found SYSTEM_RUBY_EXECUTABLE=${SYSTEM_RUBY_EXECUTABLE} with version ${_system_ruby_version}") | ||
endif() | ||
endif() | ||
|
||
if(NOT SYSTEM_RUBY_EXECUTABLE) | ||
message(WARNING "Your system ruby wasn't found, you won't be able to run the `ctest -R RubyTest` command and the tests won't be created at all.") | ||
message(WARNING "A valid system ruby (3.2.2 or near) wasn't found, you won't be able to run the `ctest -R RubyTest` command and the tests won't be created at all.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate the version of the ruby executable found.
If not the right version (I allow any 3.2.x), set not found and explain why.
Pull request overview
Pull Request Author
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.