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

Similar absolute url fix for cabal-install

In this case with index generation it's more benign, but still better
to handle things consistently.
parent 32dddcb1
......@@ -57,7 +57,7 @@ regenerateHaddockIndex verbosity pkgs conf index = do
, "--gen-index"
, "--odir=" ++ tempDir
, "--title=Haskell modules on this system" ]
++ [ "--read-interface=" ++ mkUrl html ++ "," ++ interface
++ [ "--read-interface=" ++ html ++ "," ++ interface
| (interface, html) <- paths ]
rawSystemProgram verbosity confHaddock flags
renameFile (tempDir </> "index.html") (tempDir </> destFile)
......@@ -69,11 +69,6 @@ regenerateHaddockIndex verbosity pkgs conf index = do
| (_pname, pkgvers) <- allPackagesByName pkgs
, let pkgvers' = filter exposed pkgvers
, not (null pkgvers') ]
-- See https://github.com/haskell/cabal/issues/1064
mkUrl f =
if isAbsolute f
then "file://" ++ f
else f
haddockPackagePaths :: [InstalledPackageInfo]
-> IO ([(FilePath, FilePath)], Maybe String)
......@@ -101,6 +96,14 @@ haddockPackagePaths pkgs = do
where
interfaceAndHtmlPath pkg = do
interface <- listToMaybe (InstalledPackageInfo.haddockInterfaces pkg)
html <- listToMaybe (InstalledPackageInfo.haddockHTMLs pkg)
html <- fmap fixFileUrl
(listToMaybe (InstalledPackageInfo.haddockHTMLs pkg))
guard (not . null $ html)
return (interface, html)
-- the 'haddock-html' field in the hc-pkg output is often set as a
-- native path, but we need it as a URL.
-- See https://github.com/haskell/cabal/issues/1064
fixFileUrl f | isAbsolute f = "file://" ++ f
| otherwise = f
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