From bdb84bab4edc9c45c7e505709671687b7b32cb3f Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Thu, 26 Feb 2009 16:47:43 +0000 Subject: 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 --- Setup.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Setup.hs') diff --git a/Setup.hs b/Setup.hs index ae259b80a..d40639d8d 100644 --- a/Setup.hs +++ b/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 -- cgit v1.2.3