fix warnings; fix tests; remove GHC cruft; bump to 1.1.2.3
[packages/time.git] / Setup.hs
1 module Main (main) where
2
3 import Control.Exception
4 import Distribution.PackageDescription
5 import Distribution.Simple
6 import Distribution.Simple.LocalBuildInfo
7 import Distribution.Simple.Utils
8 import System.Cmd
9 import System.Directory
10
11 main :: IO ()
12 main = do let hooks = autoconfUserHooks { runTests = runTestScript }
13 defaultMainWithHooks hooks
14
15 withCurrentDirectory :: FilePath -> IO a -> IO a
16 withCurrentDirectory path f = do
17 cur <- getCurrentDirectory
18 setCurrentDirectory path
19 finally f (setCurrentDirectory cur)
20
21 runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
22 runTestScript _args _flag _pd _lbi
23 = maybeExit $ withCurrentDirectory "test" $ system "make"