Skip to content
Browse files

Try harder to pick the correct version in cabalLibVersionToUse.

See the discussion in #1076.
  • Loading branch information...
1 parent 13850ea commit a17491d70741d28d9b6037640e6fb2b041fc81bc @23Skidoo 23Skidoo committed Oct 23, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 cabal-install/Distribution/Client/SetupWrapper.hs
View
10 cabal-install/Distribution/Client/SetupWrapper.hs
@@ -207,12 +207,18 @@ externalSetupMethod verbosity options pkg bt mkargs = do
cabalLibVersionToUse :: IO (Version, SetupScriptOptions)
cabalLibVersionToUse = do
savedVersion <- savedCabalVersion
+ let versionRangeToUse = useCabalVersion options
case savedVersion of
- Just version | version `withinRange` useCabalVersion options
+ Just version | version `withinRange` versionRangeToUse
+ -- If the Cabal lib version that cabal-install was compiled
+ -- with can be used instead of the cached version,
+ -- double-check that we really want to use the cached one.
+ && (version == cabalVersion
+ || not (cabalVersion `withinRange` versionRangeToUse))
-> return (version, options)
_ -> do (comp, conf, options') <- configureCompiler options
version <- installedCabalVersion options comp conf
- writeFile setupVersionFile (show version ++ "\n")
+ rewriteFile setupVersionFile (show version ++ "\n")
return (version, options')
savedCabalVersion = do

0 comments on commit a17491d

Please sign in to comment.
Something went wrong with that request. Please try again.