Made Setup.hs compatible with Cabal < 1.6.
Replaced a non-portable test for highlighting support with a portable one. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1552 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
75c7800d90
commit
bdb84bab4e
1 changed files with 5 additions and 6 deletions
11
Setup.hs
11
Setup.hs
|
@ -1,10 +1,7 @@
|
|||
import Distribution.Simple
|
||||
import Distribution.Package ( pkgName )
|
||||
import Distribution.Simple.LocalBuildInfo ( packageDeps )
|
||||
import Distribution.PackageDescription ( emptyHookedBuildInfo )
|
||||
import Control.Exception ( bracket_ )
|
||||
import Control.Monad ( unless )
|
||||
import System.Process ( runCommand, runProcess, waitForProcess )
|
||||
import System.Process ( runCommand, runProcess, waitForProcess, readProcess )
|
||||
import System.FilePath ( (</>), (<.>) )
|
||||
import System.Directory
|
||||
import System.IO ( stderr )
|
||||
|
@ -12,6 +9,7 @@ import System.Exit
|
|||
import System.Time
|
||||
import System.IO.Error ( isDoesNotExistError )
|
||||
import Data.Maybe ( fromJust, isNothing, catMaybes )
|
||||
import Data.List ( isInfixOf )
|
||||
|
||||
main = do
|
||||
defaultMainWithHooks $ simpleUserHooks { runTests = runTestSuite
|
||||
|
@ -19,8 +17,9 @@ main = do
|
|||
exitWith ExitSuccess
|
||||
|
||||
-- | Run test suite.
|
||||
runTestSuite _ _ _ local = do
|
||||
let highlightingSupport = (PackageName "highlighting-kate") `elem` (map pkgName $ packageDeps local)
|
||||
runTestSuite _ _ _ _ = do
|
||||
vers <- readProcess ("dist" </> "build" </> "pandoc" </> "pandoc") ["--version"] ""
|
||||
let highlightingSupport = "+highlighting" `isInfixOf` vers
|
||||
let testArgs = if highlightingSupport then ["lhs"] else []
|
||||
let testCmd = "runhaskell -i.. RunTests.hs " ++ unwords testArgs
|
||||
inDirectory "tests" $ runCommand testCmd >>= waitForProcess >>= exitWith
|
||||
|
|
Loading…
Reference in a new issue