forked from NixOS/cabal2nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finalizePD uses PackageVersionConstraint instead of dependency since 3.4.0.0 (see also haskell/cabal#5570). This is a bit annoying since we need to do some CPP-stuff to support both 3.2.* and 3.4.0.0, but it is a good opportunity to clean up our use of Dependency: Since we always ignore the `LibraryName`s in `Dependency` and it is required to be a `NonEmptySet` since 3.4.0.0, we switch to using the simpler `PackageVersionConstraint` which doesn't care about `LibraryName` at all (just like us).
- Loading branch information
1 parent
938b26d
commit 2e7dca9
Showing
6 changed files
with
45 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
module Distribution.Nixpkgs.Haskell.Constraint | ||
( Constraint, satisfiesConstraint, satisfiesConstraints | ||
( Constraint, constraintPkgName, satisfiesConstraint, satisfiesConstraints | ||
) where | ||
|
||
import Distribution.Package | ||
import Distribution.Version | ||
import Distribution.Types.PackageVersionConstraint | ||
import Distribution.Nixpkgs.Haskell.OrphanInstances ( ) | ||
|
||
type Constraint = Dependency | ||
type Constraint = PackageVersionConstraint | ||
|
||
constraintPkgName :: Constraint -> PackageName | ||
constraintPkgName (PackageVersionConstraint n _) = n | ||
|
||
satisfiesConstraint :: PackageIdentifier -> Constraint -> Bool | ||
satisfiesConstraint (PackageIdentifier pn v) (Dependency cn vr _) = (pn /= cn) || (v `withinRange` vr) | ||
satisfiesConstraint (PackageIdentifier pn v) (PackageVersionConstraint cn vr) = (pn /= cn) || (v `withinRange` vr) | ||
|
||
satisfiesConstraints :: PackageIdentifier -> [Constraint] -> Bool | ||
satisfiesConstraints p = all (satisfiesConstraint p) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters