Move HOMEBREW_SIMULATE_MACOS_ON_LINUX
handling to SimulateSystem
#13616
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.
Follow-up to #13599
This PR moves the handling of
HOMEBREW_SIMULATE_MACOS_ON_LINUX
intoSimulateSystem
. Since the env var is accomplishing the same thing as simulating using theSimulateSystem
methods, it makes sense to handle it in the same place instead of needing to have separate conditionals for the two possible ways of simulating. WhenHOMEBREW_SIMULATE_MACOS_ON_LINUX
is set, we assume that we're simulating a generic macOS version, soHomebrew::SimulateSystem.os
returns:macos
. I've also set it up so that simulations set up usingSimulateSystem
methods take precedence over the environment variable, butHomebrew::SimulateSystem.clear
will not clear the simulation since the env var is still set.In this PR, if the env var is set while actually on macOS, it is essentially a no-op.
Homebrew::SimulateSystem.os
will benil
andHomebrew::SimulateSystem.current_os
will return the symbol for whatever version of macOS is actually being used. Should setting this variable on macOS use the generic:macos
instead? I don't think I see much value in this, but it's a possibility.