Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/268f3d5a32aa4231f7189276a97a36893054e8f6 >--------------------------------------------------------------- commit 268f3d5a32aa4231f7189276a97a36893054e8f6 Author: Duncan Coutts <[email protected]> Date: Tue Jul 7 01:30:30 2009 +0000 Make the documentation toggle determine if we make the haddock index Previously the --haddock-index=template flag controled both the template used and whether it's used at all. When no path was set then it was not used. The problem with that is that since we are not enabling this feature by default then the default is blank. That is the default config file would look like: -- haddock-index: which doesn't help anyone discover what it means or what a sensible setting would be. By having a separate toggle to enable/disable we can have a default for the index file which makes it easy to discover in the config file: -- documentation: False -- doc-index-file: $datadir/doc/index.html All the user has to do is uncomment the first line and use True. >--------------------------------------------------------------- cabal-install/Distribution/Client/Install.hs | 7 ++++--- cabal-install/Distribution/Client/Setup.hs | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cabal-install/Distribution/Client/Install.hs b/cabal-install/Distribution/Client/Install.hs index 251ada3..9163ec1 100644 --- a/cabal-install/Distribution/Client/Install.hs +++ b/cabal-install/Distribution/Client/Install.hs @@ -309,7 +309,7 @@ regenerateHaddockIndex :: Verbosity -> IO () regenerateHaddockIndex verbosity packageDBs comp conf configFlags installFlags installPlan - | haddockIndexFileIsSpecified && shouldRegenerateHaddockIndex = do + | haddockIndexFileIsRequested && shouldRegenerateHaddockIndex = do defaultDirs <- InstallDirs.defaultInstallDirs (compilerFlavor comp) @@ -329,8 +329,9 @@ regenerateHaddockIndex verbosity packageDBs comp conf | otherwise = return () where - haddockIndexFileIsSpecified = - isJust (flagToMaybe (installHaddockIndex installFlags)) + haddockIndexFileIsRequested = + fromFlag (installDocumentation installFlags) + && isJust (flagToMaybe (installHaddockIndex installFlags)) -- We want to regenerate the index if some new documentation was actually -- installed. Since the index is per-user, we don't do it for global diff --git a/cabal-install/Distribution/Client/Setup.hs b/cabal-install/Distribution/Client/Setup.hs index 2790e21..b2addcd 100644 --- a/cabal-install/Distribution/Client/Setup.hs +++ b/cabal-install/Distribution/Client/Setup.hs @@ -462,7 +462,7 @@ data InstallFlags = InstallFlags { defaultInstallFlags :: InstallFlags defaultInstallFlags = InstallFlags { installDocumentation= Flag False, - installHaddockIndex = Flag . toPathTemplate $ "$datadir" </> "doc" </> "index.html", + installHaddockIndex = Flag docIndexFile, installDryRun = Flag False, installReinstall = Flag False, installOnly = Flag False, @@ -472,6 +472,8 @@ defaultInstallFlags = InstallFlags { installBuildReports = Flag NoReports, installSymlinkBinDir= mempty } + where + docIndexFile = toPathTemplate ("$datadir" </> "doc" </> "index.html") installCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags) installCommand = CommandUI { @@ -510,11 +512,12 @@ installOptions showOrParseArgs = installDocumentation (\v flags -> flags { installDocumentation = v }) (boolOpt [] []) - , option [] ["haddock-index"] - "Haddock html index file (name template shouldn't use $pkgid)" + , option [] ["doc-index-file"] + "A central index of haddock API documentation (template cannot use $pkgid)" installHaddockIndex (\v flags -> flags { installHaddockIndex = v }) (reqArg' "TEMPLATE" (toFlag.toPathTemplate) (flagToList . fmap fromPathTemplate)) + , option [] ["dry-run"] "Do not install anything, only print what would be installed." installDryRun (\v flags -> flags { installDryRun = v }) _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
