File: Setup.hs

package info (click to toggle)
haskell-rsa 1.2.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 88 kB
  • sloc: haskell: 638; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
import System.Cmd
import System.FilePath

main :: IO ()
main = defaultMainWithHooks rsaUserHooks
 where  
  rsaUserHooks = simpleUserHooks { 
    runTests = runLMTests
  , instHook = filter_test $ instHook defaultUserHooks 
  }

type Hook a = PackageDescription -> LocalBuildInfo -> UserHooks -> a -> IO ()

filter_test :: Hook a -> Hook a
filter_test f pd lbi uhs x = f pd' lbi uhs x
 where
  pd'  = pd { executables = [] }

runLMTests :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
runLMTests _args _unknown descr _lbi = system test_exe >> return ()
 where
  test_exe = "dist" </> "build" </> "test_rsa" </> (exeName $ head $ executables descr)