Skip to content

Commit

Permalink
handle Cabals 3.8 and 3.10
Browse files Browse the repository at this point in the history
tweak orphaned instances
  • Loading branch information
clinty committed Sep 21, 2023
1 parent 703efd4 commit eefed54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Debian/Debianize/InputCabal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import Distribution.Compiler (CompilerInfo)
import Distribution.Package (Package(packageId))
import Distribution.PackageDescription as Cabal (PackageDescription)
import Distribution.PackageDescription.Configuration (finalizePD)
#if MIN_VERSION_Cabal(3,8,1)
import Distribution.Simple.PackageDescription (readGenericPackageDescription)
#else
import Distribution.PackageDescription.Parsec (readGenericPackageDescription)
#endif
import Distribution.Types.ComponentRequestedSpec (ComponentRequestedSpec(ComponentRequestedSpec))
import Distribution.Simple.Utils (defaultPackageDesc, die', setupMessage)
import Distribution.System as Cabal (buildArch, Platform(..))
Expand Down
8 changes: 8 additions & 0 deletions src/Debian/Orphans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,24 @@ deriving instance Ord AbiTag
deriving instance Data Compiler
deriving instance Data CompilerId

#if !MIN_VERSION_Cabal(3,10,1)
deriving instance Ord Language
#endif
deriving instance Ord Compiler
deriving instance Ord NameAddr
#if !MIN_VERSION_Cabal(3,10,1)
deriving instance Ord License
#endif

#if !MIN_VERSION_Cabal(3,10,1)
instance Ord Executable where
compare = compare `on` exeName
#endif

#if !MIN_VERSION_Cabal(3,8,1)
instance Ord PackageDescription where
compare = compare `on` package
#endif

dropPrefix :: String -> String -> Maybe String
dropPrefix p s = if isPrefixOf p s then Just (drop (length p) s) else Nothing
Expand Down

0 comments on commit eefed54

Please sign in to comment.