make hledger-web installable with GHC < 7.6 again
Revisiting the "directory 1.2 can be installed with older GHC, so we'd better pin it in the cabal file" change. Requiring directory 1.2 made hledger-web uninstallable with GHC < 7.6 because current yesod depends on ghc which depends on a particular directory version and can't be upgraded. This is a smarter fix, which should let all hledger packages build with whatever directory version is installed.
This commit is contained in:
parent
4e4a283a84
commit
1adc583975
@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables, CPP #-}
|
||||||
{-|
|
{-|
|
||||||
|
|
||||||
Utilities for top-level modules and ghci. See also Hledger.Read and
|
Utilities for top-level modules and ghci. See also Hledger.Read and
|
||||||
@ -34,8 +34,10 @@ import System.Process (readProcessWithExitCode)
|
|||||||
import System.Time (ClockTime, getClockTime, diffClockTimes, TimeDiff(TimeDiff))
|
import System.Time (ClockTime, getClockTime, diffClockTimes, TimeDiff(TimeDiff))
|
||||||
import Test.HUnit
|
import Test.HUnit
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
|
#if MIN_VERSION_directory(1,2,0)
|
||||||
import System.Time (ClockTime(TOD))
|
import System.Time (ClockTime(TOD))
|
||||||
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
|
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
|
||||||
|
#endif
|
||||||
|
|
||||||
import Hledger.Cli.Options
|
import Hledger.Cli.Options
|
||||||
import Hledger.Data
|
import Hledger.Data
|
||||||
@ -101,9 +103,13 @@ fileModificationTime :: FilePath -> IO ClockTime
|
|||||||
fileModificationTime f
|
fileModificationTime f
|
||||||
| null f = getClockTime
|
| null f = getClockTime
|
||||||
| otherwise = (do
|
| otherwise = (do
|
||||||
|
#if MIN_VERSION_directory(1,2,0)
|
||||||
utc <- getModificationTime f
|
utc <- getModificationTime f
|
||||||
let nom = utcTimeToPOSIXSeconds utc
|
let nom = utcTimeToPOSIXSeconds utc
|
||||||
let clo = TOD (read $ takeWhile (`elem` "0123456789") $ show nom) 0 -- XXX read
|
let clo = TOD (read $ takeWhile (`elem` "0123456789") $ show nom) 0 -- XXX read
|
||||||
|
#else
|
||||||
|
clo <- getModificationTime f
|
||||||
|
#endif
|
||||||
return clo
|
return clo
|
||||||
)
|
)
|
||||||
`C.catch` \(_::C.IOException) -> getClockTime
|
`C.catch` \(_::C.IOException) -> getClockTime
|
||||||
|
|||||||
@ -67,7 +67,7 @@ library
|
|||||||
-- ,cabal-file-th
|
-- ,cabal-file-th
|
||||||
,containers
|
,containers
|
||||||
,cmdargs >= 0.10 && < 0.11
|
,cmdargs >= 0.10 && < 0.11
|
||||||
,directory >= 1.2
|
,directory
|
||||||
,filepath
|
,filepath
|
||||||
,haskeline >= 0.6 && <= 0.8
|
,haskeline >= 0.6 && <= 0.8
|
||||||
,HUnit
|
,HUnit
|
||||||
@ -120,7 +120,7 @@ executable hledger
|
|||||||
,base >= 4.3 && < 5
|
,base >= 4.3 && < 5
|
||||||
,containers
|
,containers
|
||||||
,cmdargs >= 0.10 && < 0.11
|
,cmdargs >= 0.10 && < 0.11
|
||||||
,directory >= 1.2
|
,directory
|
||||||
,filepath
|
,filepath
|
||||||
,haskeline >= 0.6 && <= 0.8
|
,haskeline >= 0.6 && <= 0.8
|
||||||
,HUnit
|
,HUnit
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user