Commit c092ca29 authored by Duncan Coutts's avatar Duncan Coutts

Fix uses of deprecated stuff

parent dfd1fc35
......@@ -60,7 +60,7 @@ import Distribution.PackageDescription.Configuration
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.Version
( VersionRange(AnyVersion, ThisVersion) )
( VersionRange, anyVersion, thisVersion )
import Distribution.Simple.Utils as Utils
( notice, info, die )
import Distribution.System
......@@ -109,7 +109,7 @@ configure verbosity packageDBs repos comp conf
where
setupScriptOptions index = SetupScriptOptions {
useCabalVersion = maybe AnyVersion ThisVersion
useCabalVersion = maybe anyVersion thisVersion
(flagToMaybe (configCabalVersion configExFlags)),
useCompiler = Just comp,
-- Hack: we typically want to allow the UserPackageDB for finding the
......@@ -153,7 +153,7 @@ planLocalPackage verbosity comp configFlags configExFlags installed
}
targets = [packageName pkg]
constraints = [PackageVersionConstraint (packageName pkg)
(ThisVersion (packageVersion pkg))
(thisVersion (packageVersion pkg))
,PackageFlagsConstraint (packageName pkg)
(configConfigurationsFlags configFlags)]
++ [ PackageVersionConstraint name ver
......
......@@ -32,7 +32,7 @@ import Distribution.PackageDescription.Configuration
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (PackageIndex)
import Distribution.Version
( VersionRange(AnyVersion, IntersectVersionRanges), withinRange )
( VersionRange, anyVersion, intersectVersionRanges, withinRange )
import Distribution.Simple.Utils
( comparing )
import Distribution.Text
......@@ -104,11 +104,11 @@ combineConstraints :: (PackageName -> PackagePreferences)
combineConstraints preferences constraints targets =
[ (name, ver, flags, pref)
| name <- targets
, let ver = fromMaybe AnyVersion (Map.lookup name versionConstraints)
, let ver = fromMaybe anyVersion (Map.lookup name versionConstraints)
flags = fromMaybe [] (Map.lookup name flagsConstraints)
PackagePreferences pref _ = preferences name ]
where
versionConstraints = Map.fromListWith IntersectVersionRanges
versionConstraints = Map.fromListWith intersectVersionRanges
[ (name, versionRange)
| PackageVersionConstraint name versionRange <- constraints ]
......
......@@ -41,7 +41,7 @@ import Distribution.PackageDescription
import Distribution.PackageDescription.Configuration
( finalizePackageDescription, flattenPackageDescription )
import Distribution.Version
( VersionRange(AnyVersion), withinRange )
( VersionRange, anyVersion, withinRange, simplifyVersionRange )
import Distribution.Compiler
( CompilerId )
import Distribution.System
......@@ -585,7 +585,7 @@ addTopLevelInstalledConstraint :: PackageName
addTopLevelInstalledConstraint pkg constraints =
Constraints.constrain taggedDep reason constraints
where
dep = Dependency pkg AnyVersion
dep = Dependency pkg anyVersion
taggedDep = TaggedDependency InstalledConstraint dep
reason = ExcludedByTopLevelDependency dep
......
......@@ -38,7 +38,7 @@ import Distribution.PackageDescription.Parse
import Distribution.ParseUtils
( ParseResult(..) )
import Distribution.Version
( VersionRange(IntersectVersionRanges) )
( intersectVersionRanges )
import Distribution.Text
( display, simpleParse )
import Distribution.Verbosity (Verbosity)
......@@ -83,7 +83,7 @@ getAvailablePackages verbosity repos = do
info verbosity "Reading available packages..."
pkgss <- mapM (readRepoIndex verbosity) repos
let (pkgs, prefs) = mconcat pkgss
prefs' = Map.fromListWith IntersectVersionRanges
prefs' = Map.fromListWith intersectVersionRanges
[ (name, range) | Dependency name range <- prefs ]
evaluate pkgs
evaluate prefs'
......
......@@ -103,7 +103,7 @@ import Distribution.PackageDescription.Configuration
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.Version
( Version, VersionRange(AnyVersion, ThisVersion) )
( Version, VersionRange, anyVersion, thisVersion )
import Distribution.Simple.Utils as Utils
( notice, info, warn, die, intercalate )
import Distribution.Client.Utils
......@@ -225,7 +225,7 @@ installWithPlanner planner verbosity packageDBs repos comp conf
where
setupScriptOptions index = SetupScriptOptions {
useCabalVersion = maybe AnyVersion ThisVersion (libVersion miscOptions),
useCabalVersion = maybe anyVersion thisVersion (libVersion miscOptions),
useCompiler = Just comp,
-- Hack: we typically want to allow the UserPackageDB for finding the
-- Cabal lib when compiling any Setup.hs even if we're doing a global
......@@ -318,7 +318,7 @@ planLocalPackage verbosity comp configFlags configExFlags installed
}
targets = [packageName pkg]
constraints = [PackageVersionConstraint (packageName pkg)
(ThisVersion (packageVersion pkg))
(thisVersion (packageVersion pkg))
,PackageFlagsConstraint (packageName pkg)
(configConfigurationsFlags configFlags)]
++ [ PackageVersionConstraint name ver
......
......@@ -46,14 +46,12 @@ import qualified Distribution.Simple.Setup as Cabal
import Distribution.Simple.Setup
( ConfigFlags(..) )
import Distribution.Simple.Setup
( Flag(..), toFlag, fromFlag, flagToList, flagToMaybe, fromFlagOrDefault
( Flag(..), toFlag, fromFlag, flagToList, flagToMaybe
, optionVerbosity, trueArg )
import Distribution.Simple.Compiler
( PackageDB(..) )
import Distribution.Simple.InstallDirs
( PathTemplate, toPathTemplate, fromPathTemplate )
import Distribution.Version
( Version(Version), VersionRange(..) )
( Version(Version), anyVersion, thisVersion )
import Distribution.Package
( PackageIdentifier, packageName, packageVersion, Dependency(..) )
import Distribution.Text
......@@ -689,8 +687,8 @@ parseDependencyOrPackageId = parse Parse.+++ liftM pkgidToDependency parse
where
pkgidToDependency :: PackageIdentifier -> Dependency
pkgidToDependency p = case packageVersion p of
Version [] _ -> Dependency (packageName p) AnyVersion
version -> Dependency (packageName p) (ThisVersion version)
Version [] _ -> Dependency (packageName p) anyVersion
version -> Dependency (packageName p) (thisVersion version)
showRepo :: RemoteRepo -> String
showRepo repo = remoteRepoName repo ++ ":"
......
......@@ -23,7 +23,8 @@ module Distribution.Client.SetupWrapper (
import qualified Distribution.Make as Make
import qualified Distribution.Simple as Simple
import Distribution.Version
( Version(..), VersionRange(..), withinRange )
( Version(..), VersionRange, anyVersion, intersectVersionRanges
, withinRange )
import Distribution.Package
( PackageIdentifier(..), PackageName(..), Package(..), packageName
, packageVersion, Dependency(..) )
......@@ -83,7 +84,7 @@ data SetupScriptOptions = SetupScriptOptions {
defaultSetupScriptOptions :: SetupScriptOptions
defaultSetupScriptOptions = SetupScriptOptions {
useCabalVersion = AnyVersion,
useCabalVersion = anyVersion,
useCompiler = Nothing,
usePackageDB = [GlobalPackageDB, UserPackageDB],
usePackageIndex = Nothing,
......@@ -104,7 +105,7 @@ setupWrapper verbosity options mpkg cmd flags extraArgs = do
pkg <- maybe getPkg return mpkg
let setupMethod = determineSetupMethod options' buildType'
options' = options {
useCabalVersion = IntersectVersionRanges
useCabalVersion = intersectVersionRanges
(useCabalVersion options)
(descCabalVersion pkg)
}
......
......@@ -22,7 +22,8 @@ import Distribution.Simple.PackageIndex as PackageIndex (lookupDependency)
import Distribution.Simple.Setup(fromFlag, fromFlagOrDefault)
import Distribution.Simple.Utils(info, notice, die)
import Distribution.Text(display)
import Distribution.Version (VersionRange(..))
import Distribution.Version
( anyVersion, intersectVersionRanges )
import Distribution.Client.Setup(UnpackFlags(unpackVerbosity,
unpackDestDir))
......@@ -89,8 +90,8 @@ resolvePackages (AvailablePackageDb available prefs) deps =
candidates dep@(Dependency name ver) =
let [x,y] = map (PackageIndex.lookupDependency available)
[ Dependency name
(maybe AnyVersion id (Map.lookup name prefs)
`IntersectVersionRanges` ver)
(maybe anyVersion id (Map.lookup name prefs)
`intersectVersionRanges` ver)
, dep ]
in if null x then y else x
best d [] = Left d
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment