Skip to content

Commit

Permalink
Show the number, change the wording
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Jan 20, 2025
1 parent b581165 commit e854972
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Cabal/src/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ import Text.PrettyPrint
, char
, colon
, hsep
, int
, nest
, parens
, quotes
, renderStyle
, text
Expand Down Expand Up @@ -898,10 +900,11 @@ configurePackage cfg lbc0 pkg_descr00 flags enabled comp platform programDb0 pac
(merged, ds@(dup : _)) ->
noticeDoc verbosity $
vcat
[ (text "The build tool" <+> quotes (text $ nameOf dup) <+> "has multiple versions specified") <> colon
, nest 2 $ vcat [char '-' <+> text (prettyShow $ versionOf d) | d <- ds]
, text "These versions have been combined as" <> colon
, nest 2 $ quotes (text $ prettyShow merged)
[ (text "As the build tool" <+> quotes (text $ nameOf dup) <+> "was specified more than once") <> colon
, nest 2 $ vcat [char '-' <+> versionOfDoc d | d <- ds]
, (text "We'll use the effective intersection of these" <+> int (length ds) <+> "version ranges") <> colon
, nest 2 $ char '-' <+> versionOfDoc merged
, text "Please specify build tool dependencies only once."
]

programDb1 <-
Expand Down Expand Up @@ -959,6 +962,12 @@ nameOf (LegacyExeDependency n _) = n
versionOf :: LegacyExeDependency -> VersionRange
versionOf (LegacyExeDependency _ v) = v

versionOfDoc :: LegacyExeDependency -> Doc
versionOfDoc (LegacyExeDependency _ v) =
if v == anyVersion
then text (prettyShow v) <+> parens (text "any version")
else text $ prettyShow v

-- | Any duplicates in the list has their version range merged by intersection.
-- The second list has the build tool with its merged version range and its list
-- of duplicates.
Expand Down

0 comments on commit e854972

Please sign in to comment.