summaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-01-17 00:28:42 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-01-17 00:28:42 +0000
commitbd8ac75e5124975e48a79e8fbfb39bb722171662 (patch)
tree1ef20c97df8ca26a0893f5afb300ab0b54a2fa70 /Setup.hs
parent9b9c26c6e5e58922002cc2743b5bf052b244cce8 (diff)
Setup: Made man page building sensitive to build verbosity.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1812 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/Setup.hs b/Setup.hs
index 8bf2c334a..bd48dbe6e 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -5,7 +5,7 @@ import Distribution.PackageDescription
(PackageDescription(..), Executable(..), BuildInfo(..))
import Distribution.Simple.LocalBuildInfo
(LocalBuildInfo(..), absoluteInstallDirs)
-import Distribution.Verbosity ( Verbosity )
+import Distribution.Verbosity ( Verbosity, silent )
import Distribution.Simple.InstallDirs (mandir, bindir, CopyDest (NoCopyDest))
import Distribution.Simple.Utils (copyFiles)
import Control.Exception ( bracket_ )
@@ -48,7 +48,7 @@ runTestSuite _ _ pkg _ = do
-- | Build man pages from markdown sources in man/man1/.
makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
-makeManPages _ _ _ _ = mapM_ makeManPage manpages
+makeManPages _ flags _ _ = mapM_ (makeManPage (fromFlag $ buildVerbosity flags)) manpages
manpages :: [FilePath]
manpages = ["pandoc.1", "hsmarkdown.1", "html2markdown.1", "markdown2pdf.1"]
@@ -57,8 +57,8 @@ manDir :: FilePath
manDir = "man" </> "man1"
-- | Build a man page from markdown source in man/man1.
-makeManPage :: FilePath -> IO ()
-makeManPage manpage = do
+makeManPage :: Verbosity -> FilePath -> IO ()
+makeManPage verbosity manpage = do
let pandoc = "dist" </> "build" </> "pandoc" </> "pandoc"
let page = manDir </> manpage
let source = manDir </> manpage <.> "md"
@@ -68,7 +68,8 @@ makeManPage manpage = do
"--template=templates/man.template", "-o", page, source]
Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess
case ec of
- ExitSuccess -> putStrLn $ "Created " ++ manDir </> manpage
+ ExitSuccess -> unless (verbosity == silent) $
+ putStrLn $ "Created " ++ manDir </> manpage
_ -> do putStrLn $ "Error creating " ++ manDir </> manpage
exitWith ec