Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a3024a9bf14447074e16b64f505673920755eeac

>---------------------------------------------------------------

commit a3024a9bf14447074e16b64f505673920755eeac
Author: Duncan Coutts <[email protected]>
Date:   Sun Mar 27 16:40:48 2011 +0000

    Distinguish installed constraint error messages

>---------------------------------------------------------------

 .../Distribution/Client/Dependency/TopDown.hs      |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/cabal-install/Distribution/Client/Dependency/TopDown.hs 
b/cabal-install/Distribution/Client/Dependency/TopDown.hs
index 1ca99f5..241a6a3 100644
--- a/cabal-install/Distribution/Client/Dependency/TopDown.hs
+++ b/cabal-install/Distribution/Client/Dependency/TopDown.hs
@@ -42,6 +42,7 @@ import Distribution.PackageDescription.Configuration
          ( finalizePackageDescription, flattenPackageDescription )
 import Distribution.Version
          ( VersionRange, anyVersion, withinRange, simplifyVersionRange
+         , isAnyVersion
          , UpperBound(..), asVersionIntervals )
 import Distribution.Compiler
          ( CompilerId )
@@ -635,6 +636,7 @@ addTopLevelVersionConstraint pkgname verrange =
   where
     constraint ver _installed = ver `withinRange` verrange
     reason = ExcludedByTopLevelDependency (Dependency pkgname verrange)
+                                          NoInstalledConstraint
 
 addTopLevelInstalledConstraint :: PackageName
                                -> Constraints
@@ -645,6 +647,7 @@ addTopLevelInstalledConstraint pkgname =
   where
     constraint _ver installed = installed
     reason = ExcludedByTopLevelDependency (Dependency pkgname anyVersion)
+                                          InstalledConstraint
 
 -- ------------------------------------------------------------
 -- * Reasons for constraints
@@ -671,7 +674,8 @@ data ExclusionReason =
      -- | We excluded this version of the package because it did not satisfy
      -- a dependency given as an original top level input.
      --
-   | ExcludedByTopLevelDependency Dependency
+   | ExcludedByTopLevelDependency Dependency InstalledConstraint
+  deriving Eq
 
 -- | Given an excluded package and the reason it was excluded, produce a human
 -- readable explanation.
@@ -685,8 +689,14 @@ showExclusionReason pkgid ExcludedByConfigureFail =
 showExclusionReason pkgid (ExcludedByPackageDependency pkgid' dep _) =
   display pkgid ++ " was excluded because " ++
   display pkgid' ++ " requires " ++ displayDep dep
-showExclusionReason pkgid (ExcludedByTopLevelDependency dep) =
-  display pkgid ++ " was excluded because of the top level dependency " ++
+showExclusionReason pkgid (ExcludedByTopLevelDependency
+                            (Dependency pkgname verRange) InstalledConstraint)
+  | isAnyVersion verRange
+  = display pkgid ++ " was excluded because only installed instances of "
+ ++ display pkgname ++ " can be selected."
+
+showExclusionReason pkgid (ExcludedByTopLevelDependency dep _) =
+  display pkgid ++ " was excluded because of the top level constraint " ++
   displayDep dep
 
 



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to