diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-02-26 16:47:43 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-02-26 16:47:43 +0000 |
commit | bdb84bab4edc9c45c7e505709671687b7b32cb3f (patch) | |
tree | 55783a988c1b844dc65ea4551484ba497f250570 /Setup.hs | |
parent | 75c7800d90446f24bd6819360b7d6967db35d9b7 (diff) |
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
Diffstat (limited to 'Setup.hs')
-rw-r--r-- | Setup.hs | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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 |