still need to invoke cabal on 7.4

This commit is contained in:
gregwebs 2012-04-02 07:11:19 -07:00
parent 1ccbf5ce06
commit 0020feff62

View File

@ -25,7 +25,7 @@ import qualified Data.Set as Set
import qualified System.Posix.Types import qualified System.Posix.Types
import System.Directory import System.Directory
import System.FilePath (replaceExtension, (</>)) import System.FilePath (takeExtension, replaceExtension, (</>))
import System.PosixCompat.Files (getFileStatus, setFileTimes, import System.PosixCompat.Files (getFileStatus, setFileTimes,
accessTime, modificationTime) accessTime, modificationTime)
import Data.Char (isUpper) import Data.Char (isUpper)
@ -120,14 +120,13 @@ findHaskellFiles path = do
else return [] else return []
where where
-- this could fail on unicode -- this could fail on unicode
isHaskellDir = isUpper (head filename) isHaskellDir = isUpper (head filename)
isHaskellFile = ".hs" `isSuffixOf` filename || ".lhs" `isSuffixOf` filename isHaskellFile = takeExtension filename `elem` watch_files
full = path </> filename full = path </> filename
watch_files = [".hs", ".lhs"]
data TempType = Verbatim | Messages FilePath | StaticFiles FilePath data TempType = StaticFiles FilePath
#if __GLASGOW_HASKELL__ < 704 | Verbatim | Messages FilePath | Hamlet
| Hamlet
#endif
deriving Show deriving Show
determineDeps :: FilePath -> IO [FilePath] determineDeps :: FilePath -> IO [FilePath]
@ -138,19 +137,16 @@ determineDeps x = do
A.Fail{} -> return [] A.Fail{} -> return []
A.Done _ r -> mapM go r >>= filterM doesFileExist . concat A.Done _ r -> mapM go r >>= filterM doesFileExist . concat
where where
#if __GLASGOW_HASKELL__ < 704 go (Just (StaticFiles fp, _)) = getFolderContents fp
go (Just (Hamlet, f)) = return [f, "templates/" ++ f ++ ".hamlet"] go (Just (Hamlet, f)) = return [f, "templates/" ++ f ++ ".hamlet"]
#endif
go (Just (Verbatim, f)) = return [f] go (Just (Verbatim, f)) = return [f]
go (Just (Messages f, _)) = return [f] go (Just (Messages f, _)) = return [f]
go (Just (StaticFiles fp, _)) = getFolderContents fp
go Nothing = return [] go Nothing = return []
parser = do parser = do
ty <- (do _ <- A.string "\nstaticFiles \"" ty <- (do _ <- A.string "\nstaticFiles \""
x' <- A.many1 $ A.satisfy (/= '"') x' <- A.many1 $ A.satisfy (/= '"')
return $ StaticFiles x') return $ StaticFiles x')
#if __GLASGOW_HASKELL__ < 704
<|> (A.string "$(parseRoutesFile " >> return Verbatim) <|> (A.string "$(parseRoutesFile " >> return Verbatim)
<|> (A.string "$(hamletFile " >> return Hamlet) <|> (A.string "$(hamletFile " >> return Hamlet)
<|> (A.string "$(ihamletFile " >> return Hamlet) <|> (A.string "$(ihamletFile " >> return Hamlet)
@ -173,7 +169,6 @@ determineDeps x = do
y <- A.many1 $ A.satisfy (/= '"') y <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\"" _ <- A.string "\""
return $ Messages $ concat [x', "/", y, ".msg"]) return $ Messages $ concat [x', "/", y, ".msg"])
#endif
case ty of case ty of
Messages{} -> return $ Just (ty, "") Messages{} -> return $ Just (ty, "")
StaticFiles{} -> return $ Just (ty, "") StaticFiles{} -> return $ Just (ty, "")