Commit ad1b096f authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Print a more helpful message when haddock's ghc version doesn't match

Eg now says something like:
cabal: Haddock's internal GHC version must match the configured GHC version.
The GHC version is 6.8.2 but haddock is using GHC version 6.10.1
parent afc16032
......@@ -168,12 +168,18 @@ haddock pkg_descr lbi suffixes flags = do
die "haddock --hyperlink-source requires Haddock version 0.8 or later"
when isVersion2 $ do
haddockGhcVersion <- simpleParse `fmap` rawSystemProgramStdout verbosity confHaddock ["--ghc-version"]
case haddockGhcVersion of
haddockGhcVersionStr <- rawSystemProgramStdout verbosity confHaddock
["--ghc-version"]
case simpleParse haddockGhcVersionStr of
Nothing -> die "Could not get GHC version from Haddock"
Just v ->
when (v /= compilerVersion (compiler lbi)) $
die "Haddock's internal GHC version must match the configured GHC version"
Just haddockGhcVersion
| haddockGhcVersion == ghcVersion -> return ()
| otherwise -> die $
"Haddock's internal GHC version must match the configured "
++ "GHC version.\n"
++ "The GHC version is " ++ display ghcVersion ++ " but "
++ "haddock is using GHC version " ++ display haddockGhcVersion
where ghcVersion = compilerVersion (compiler lbi)
-- the tools match the requests, we can proceed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment