Skip to content

Commit

Permalink
Remove Cabal version check that applied to already not supported <1.1…
Browse files Browse the repository at this point in the history
…9.2 (close #2023)

We used to check that, under presence of --allow-newer/older, Cabal version is >=1.19.2 (earlier versions don't get these flags), but we no longer support <.1.19.2 anyway, so the check is not needed. Remove.
  • Loading branch information
ulysses4ever committed Jun 6, 2022
1 parent 49a4946 commit 11a5dd2
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions cabal-install/src/Distribution/Client/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ import qualified Distribution.PackageDescription as PkgDesc
import Distribution.PackageDescription.Configuration
( finalizePD )
import Distribution.Version
( Version, mkVersion, anyVersion, thisVersion
, VersionRange, orLaterVersion )
( Version, anyVersion, thisVersion
, VersionRange )
import Distribution.Simple.Utils as Utils
( warn, notice, debug, die'
, defaultPackageDesc )
Expand All @@ -84,21 +84,12 @@ import Distribution.System
import System.FilePath ( (</>) )

-- | Choose the Cabal version such that the setup scripts compiled against this
-- version will support the given command-line flags.
-- version will support the given command-line flags. Currently, it implements no
-- specific restrictions and allows any version, unless the second argument is
-- filled with a `Version`, in which case this version is picked.
chooseCabalVersion :: ConfigExFlags -> Maybe Version -> VersionRange
chooseCabalVersion configExFlags maybeVersion =
maybe defaultVersionRange thisVersion maybeVersion
where
-- Cabal < 1.19.2 doesn't support '--exact-configuration' which is needed
-- for '--allow-newer' to work.
allowNewer = isRelaxDeps
(maybe mempty unAllowNewer $ configAllowNewer configExFlags)
allowOlder = isRelaxDeps
(maybe mempty unAllowOlder $ configAllowOlder configExFlags)

defaultVersionRange = if allowOlder || allowNewer
then orLaterVersion (mkVersion [1,19,2])
else anyVersion
chooseCabalVersion _configExFlags maybeVersion =
maybe anyVersion thisVersion maybeVersion

-- | Configure the package found in the local directory
configure :: Verbosity
Expand Down

0 comments on commit 11a5dd2

Please sign in to comment.