summaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-01-17 00:28:36 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-01-17 00:28:36 +0000
commit9b9c26c6e5e58922002cc2743b5bf052b244cce8 (patch)
treeff317ed7c04598cfcb798400f0ba258cccab8cc8 /Setup.hs
parentd0879bcc13f9211188463c544e1b7233ec179937 (diff)
Setup.hs : -Wall and hlint cleanup.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1811 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs23
1 files changed, 13 insertions, 10 deletions
diff --git a/Setup.hs b/Setup.hs
index 1b27bad44..8bf2c334a 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,10 +1,10 @@
import Distribution.Simple
import Distribution.Simple.Setup
- (copyDest, copyVerbosity, fromFlag, installVerbosity)
+ (copyDest, copyVerbosity, fromFlag, installVerbosity, BuildFlags(..))
import Distribution.PackageDescription
- ( PackageDescription(..), Executable(..), BuildInfo(..) )
+ (PackageDescription(..), Executable(..), BuildInfo(..))
import Distribution.Simple.LocalBuildInfo
- ( LocalBuildInfo(..), absoluteInstallDirs )
+ (LocalBuildInfo(..), absoluteInstallDirs)
import Distribution.Verbosity ( Verbosity )
import Distribution.Simple.InstallDirs (mandir, bindir, CopyDest (NoCopyDest))
import Distribution.Simple.Utils (copyFiles)
@@ -13,17 +13,18 @@ import Control.Monad ( unless )
import System.Process ( runCommand, runProcess, waitForProcess )
import System.FilePath ( (</>), (<.>) )
import System.Directory
-import System.IO ( stderr, openTempFile )
+import System.IO ( stderr )
import System.Exit
import System.Time
import System.IO.Error ( isDoesNotExistError )
-import Data.Maybe ( fromJust, isNothing, catMaybes )
-import Data.List ( isInfixOf, (\\) )
+import Data.Maybe ( catMaybes )
+import Data.List ( (\\) )
+main :: IO ()
main = do
defaultMainWithHooks $ simpleUserHooks {
runTests = runTestSuite
- , postBuild = makeManPages
+ , postBuild = makeManPages
, postCopy = \ _ flags pkg lbi -> do
installManpages pkg lbi (fromFlag $ copyVerbosity flags)
(fromFlag $ copyDest flags)
@@ -36,17 +37,18 @@ main = do
exitWith ExitSuccess
-- | Run test suite.
+runTestSuite :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO a
runTestSuite _ _ pkg _ = do
let isHighlightingKate (Dependency (PackageName "highlighting-kate") _) = True
isHighlightingKate _ = False
let highlightingSupport = any isHighlightingKate $ buildDepends pkg
- let testArgs = if highlightingSupport then ["lhs"] else []
+ let testArgs = ["lhs" | highlightingSupport]
let testCmd = "runhaskell -i.. RunTests.hs " ++ unwords testArgs
inDirectory "tests" $ runCommand testCmd >>= waitForProcess >>= exitWith
-- | Build man pages from markdown sources in man/man1/.
-makeManPages _ _ _ _ = do
- mapM_ makeManPage manpages
+makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
+makeManPages _ _ _ _ = mapM_ makeManPage manpages
manpages :: [FilePath]
manpages = ["pandoc.1", "hsmarkdown.1", "html2markdown.1", "markdown2pdf.1"]
@@ -55,6 +57,7 @@ manDir :: FilePath
manDir = "man" </> "man1"
-- | Build a man page from markdown source in man/man1.
+makeManPage :: FilePath -> IO ()
makeManPage manpage = do
let pandoc = "dist" </> "build" </> "pandoc" </> "pandoc"
let page = manDir </> manpage