cabal
cabal copied to clipboard
only check for compiler when project file has conditionals
Should be a simple fix for https://github.com/haskell/cabal/issues/8352 -- first check that a project file has conditionals before attempting to fetch the compiler/arch etc info for use in evaluating them. That way, as long as a project file does not have conditionals, actions which did not require ghc to be available (such as sdist) will remain not requiring ghc.
- [ ] Any changes that could be relevant to users have been recorded in the changelog.
- [ ] The documentation has been updated, if necessary.
- [x] Tests
@mergify rebase
rebase
✅ Branch has been successfully rebased
Added a test, but it succeeds even when it should fail because I can't set the env to not have ghc in the path properly somehow. Setting it to Nothing makes the system scream about how there's no path at all, but setting it to Just "" doesn't seem to kill the path, just to like not append to it? sigh.
Also I discovered in working on this that sdist's fix to respect project options in https://github.com/haskell/cabal/pull/8109 was incomplete and I made a hopefully totally safe change to fix that too...
(live testing as requested in cabal-dev meet)
I can confirm that on my dev machine, with GHC not in PATH, cabal update:
- in
mastercomplains about missing GHC; - in
gb/compiler-check-logicdoes not.
As per our discussion in the meeting, we don't seem to be able to test with an altered path missing ghc, so I've rolled back the not-working tests and we'll rely on manual verification. After I fix up docs and changelog this is ready for merge.
Last minute idea about a test to show that GHC is not needed... I see a bunch of withEnv [("WITH_GHC", Just ghc_path)] in the test suite right now. Perhaps, if you have garbage in ghc_path, it will fall if and only if it's trying to call GHC?
good thought, but i just tried that and that didn't work either. Terribly confusing.
i suppose it relies in the PATH anyways, maybe a withEnv [("PATH", Just ${pathWithoutGHC})] would do the trick
@jneira Gershom tried it, see above:
setting it to Just "" doesn't seem to kill the path, just to like not append to it? sigh
@gbaz: would you prefer a merge_me or a squash_me?
Certainly a squash -- I was hoping to update the docs first, but will not be able to get to it until next week.
Let me squash if for you, in that case. :)
Mergify probably balks at the merge delay passed label being tweaked manually (due to mergify script revisions), so we've got one more chance to edit this PR. @gbaz: are we merging or would you like to update the docs first?
@Mikolaj added changelog and docs. Please do squash/merge!
With pleasure.
@mergify rebase
rebase