Set upper bound on setup.Cabal relative to current version
[cabal.git] / cabal-install / Distribution / Solver / Types / ConstraintSource.hs
blob16afd2e0d8098d56dba21796f3de2564009e4196
1 {-# LANGUAGE DeriveGeneric #-}
2 module Distribution.Solver.Types.ConstraintSource
3 ( ConstraintSource(..)
4 , showConstraintSource
5 ) where
7 import GHC.Generics (Generic)
8 import Distribution.Compat.Binary (Binary(..))
10 -- | Source of a 'PackageConstraint'.
11 data ConstraintSource =
13 -- | Main config file, which is ~/.cabal/config by default.
14 ConstraintSourceMainConfig FilePath
16 -- | Local cabal.project file
17 | ConstraintSourceProjectConfig FilePath
19 -- | Sandbox config file, which is ./cabal.sandbox.config by default.
20 | ConstraintSourceSandboxConfig FilePath
22 -- | User config file, which is ./cabal.config by default.
23 | ConstraintSourceUserConfig FilePath
25 -- | Flag specified on the command line.
26 | ConstraintSourceCommandlineFlag
28 -- | Target specified by the user, e.g., @cabal install package-0.1.0.0@
29 -- implies @package==0.1.0.0@.
30 | ConstraintSourceUserTarget
32 -- | Internal requirement to use installed versions of packages like ghc-prim.
33 | ConstraintSourceNonUpgradeablePackage
35 -- | Internal requirement to use the add-source version of a package when that
36 -- version is installed and the source is modified.
37 | ConstraintSourceModifiedAddSourceDep
39 -- | Internal constraint used by @cabal freeze@.
40 | ConstraintSourceFreeze
42 -- | Constraint specified by a config file, a command line flag, or a user
43 -- target, when a more specific source is not known.
44 | ConstraintSourceConfigFlagOrTarget
46 -- | The source of the constraint is not specified.
47 | ConstraintSourceUnknown
49 -- | An internal constraint due to compatibility issues with the Setup.hs
50 -- command line interface requires a minimum lower bound on Cabal
51 | ConstraintSetupCabalMinVersion
53 -- | An internal constraint due to compatibility issues with the Setup.hs
54 -- command line interface requires a maximum upper bound on Cabal
55 | ConstraintSetupCabalMaxVersion
56 deriving (Eq, Show, Generic)
58 instance Binary ConstraintSource
60 -- | Description of a 'ConstraintSource'.
61 showConstraintSource :: ConstraintSource -> String
62 showConstraintSource (ConstraintSourceMainConfig path) =
63 "main config " ++ path
64 showConstraintSource (ConstraintSourceProjectConfig path) =
65 "project config " ++ path
66 showConstraintSource (ConstraintSourceSandboxConfig path) =
67 "sandbox config " ++ path
68 showConstraintSource (ConstraintSourceUserConfig path)= "user config " ++ path
69 showConstraintSource ConstraintSourceCommandlineFlag = "command line flag"
70 showConstraintSource ConstraintSourceUserTarget = "user target"
71 showConstraintSource ConstraintSourceNonUpgradeablePackage =
72 "non-upgradeable package"
73 showConstraintSource ConstraintSourceModifiedAddSourceDep =
74 "modified add-source dependency"
75 showConstraintSource ConstraintSourceFreeze = "cabal freeze"
76 showConstraintSource ConstraintSourceConfigFlagOrTarget =
77 "config file, command line flag, or user target"
78 showConstraintSource ConstraintSourceUnknown = "unknown source"
79 showConstraintSource ConstraintSetupCabalMinVersion =
80 "minimum version of Cabal used by Setup.hs"
81 showConstraintSource ConstraintSetupCabalMaxVersion =
82 "maximum version of Cabal used by Setup.hs"