Fix ghc-7.8
This commit is contained in:
parent
7b8540add1
commit
4c93819da8
@ -23,7 +23,10 @@ import Control.Monad (filterM)
|
|||||||
import CoreMonad (liftIO)
|
import CoreMonad (liftIO)
|
||||||
import Data.Maybe (maybeToList)
|
import Data.Maybe (maybeToList)
|
||||||
import Data.Set (fromList, toList)
|
import Data.Set (fromList, toList)
|
||||||
import Data.List (find,tails,isPrefixOf,nub,stripPrefix)
|
import Data.List (find,tails,isPrefixOf)
|
||||||
|
#if !MIN_VERSION_Cabal(1,18,0)
|
||||||
|
import Data.List (nub,stripPrefix)
|
||||||
|
#endif
|
||||||
import Distribution.ModuleName (ModuleName,toFilePath)
|
import Distribution.ModuleName (ModuleName,toFilePath)
|
||||||
import Distribution.Package (Dependency(Dependency)
|
import Distribution.Package (Dependency(Dependency)
|
||||||
, PackageName(PackageName)
|
, PackageName(PackageName)
|
||||||
@ -39,7 +42,7 @@ import Distribution.Simple.Program (ghcProgram)
|
|||||||
import Distribution.Simple.Program.Types (programName, programFindVersion)
|
import Distribution.Simple.Program.Types (programName, programFindVersion)
|
||||||
import Distribution.Simple.BuildPaths (defaultDistPref)
|
import Distribution.Simple.BuildPaths (defaultDistPref)
|
||||||
import Distribution.Simple.Configure (localBuildInfoFile)
|
import Distribution.Simple.Configure (localBuildInfoFile)
|
||||||
import Distribution.Simple.LocalBuildInfo (ComponentLocalBuildInfo(..))
|
import Distribution.Simple.LocalBuildInfo (ComponentLocalBuildInfo(..), ComponentName)
|
||||||
import Distribution.System (buildPlatform)
|
import Distribution.System (buildPlatform)
|
||||||
import Distribution.Text (display)
|
import Distribution.Text (display)
|
||||||
import Distribution.Verbosity (silent)
|
import Distribution.Verbosity (silent)
|
||||||
@ -230,7 +233,7 @@ cabalConfigDependencies :: PackageIdentifier -> CabalConfig -> [Package]
|
|||||||
cabalConfigDependencies thisPkg config = cfgDepends
|
cabalConfigDependencies thisPkg config = cfgDepends
|
||||||
where
|
where
|
||||||
pids :: [InstalledPackageId]
|
pids :: [InstalledPackageId]
|
||||||
pids = fst <$> components
|
pids = fst <$> components thisPkg
|
||||||
cfgDepends = filter (("inplace" /=) . pkgId)
|
cfgDepends = filter (("inplace" /=) . pkgId)
|
||||||
$ fromInstalledPackageId <$> pids
|
$ fromInstalledPackageId <$> pids
|
||||||
|
|
||||||
@ -238,22 +241,26 @@ cabalConfigDependencies thisPkg config = cfgDepends
|
|||||||
"cabalConfigDependencies: Extracting field `"++ f ++"' from"
|
"cabalConfigDependencies: Extracting field `"++ f ++"' from"
|
||||||
++ " setup-config failed"
|
++ " setup-config failed"
|
||||||
|
|
||||||
components :: [(InstalledPackageId,PackageIdentifier)]
|
components :: PackageIdentifier -> [(InstalledPackageId,PackageIdentifier)]
|
||||||
#if MIN_VERSION_Cabal(1,18,0)
|
#if MIN_VERSION_Cabal(1,18,0)
|
||||||
components = case extractCabalSetupConfig config "componentsConfigs" of
|
components _ = case extractCabalSetupConfig config "componentsConfigs" of
|
||||||
Just comps -> componentPackageDeps . lbi <$> comps
|
Just comps -> concatMap (componentPackageDeps . lbi) comps
|
||||||
Nothing -> errorExtract "componentsConfigs"
|
Nothing -> errorExtract "componentsConfigs"
|
||||||
|
|
||||||
lbi :: (ComponentName, ComponentLocalBuildInfo, [ComponentName])
|
lbi :: (ComponentName, ComponentLocalBuildInfo, [ComponentName])
|
||||||
-> ComponentLocalBuildInfo
|
-> ComponentLocalBuildInfo
|
||||||
lbi (_,i,_) = i
|
lbi (_,i,_) = i
|
||||||
#elif MIN_VERSION_Cabal(1,16,0)
|
#elif MIN_VERSION_Cabal(1,16,0)
|
||||||
components = filter (not . internal . snd) $ nub $
|
components thisPkg' = filter (not . internal . snd) $ nub $
|
||||||
maybe [] componentPackageDeps libraryConfig
|
maybe [] componentPackageDeps libraryConfig
|
||||||
++ concatMap (componentPackageDeps . snd) executableConfigs
|
++ concatMap (componentPackageDeps . snd) executableConfigs
|
||||||
++ concatMap (componentPackageDeps . snd) testSuiteConfigs
|
++ concatMap (componentPackageDeps . snd) testSuiteConfigs
|
||||||
++ concatMap (componentPackageDeps . snd) benchmarkConfigs
|
++ concatMap (componentPackageDeps . snd) benchmarkConfigs
|
||||||
where
|
where
|
||||||
|
-- True if this dependency is an internal one (depends on the library
|
||||||
|
-- defined in the same package).
|
||||||
|
internal pkgid = pkgid == thisPkg'
|
||||||
|
|
||||||
executableConfigs :: [(String, ComponentLocalBuildInfo)]
|
executableConfigs :: [(String, ComponentLocalBuildInfo)]
|
||||||
executableConfigs = extract "executableConfigs"
|
executableConfigs = extract "executableConfigs"
|
||||||
|
|
||||||
@ -275,11 +282,6 @@ cabalConfigDependencies thisPkg config = cfgDepends
|
|||||||
extract field = case extractCabalSetupConfig config field of
|
extract field = case extractCabalSetupConfig config field of
|
||||||
Nothing -> errorExtract field
|
Nothing -> errorExtract field
|
||||||
Just f -> f
|
Just f -> f
|
||||||
|
|
||||||
|
|
||||||
-- True if this dependency is an internal one (depends on the library
|
|
||||||
-- defined in the same package).
|
|
||||||
internal pkgid = pkgid == thisPkg
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
-- | Extract part of cabal's @setup-config@, this is done with a mix of manual
|
-- | Extract part of cabal's @setup-config@, this is done with a mix of manual
|
||||||
|
Loading…
Reference in New Issue
Block a user