Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Commit 0752e56

Browse files
committed
hptool: Support Cabal-1.25
1 parent f870630 commit 0752e56

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

hptool/src/OS/Win.hs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ import Paths
2626
import Types
2727
import Utils
2828

29+
#if MIN_VERSION_Cabal(1,25,0)
30+
getPkgId :: C.HasUnitId pkg => pkg -> String
31+
getPkgId pkg = case C.installedUnitId pkg of
32+
C.SimpleUnitId (C.ComponentId s) -> s
33+
#else
34+
getPkgId :: C.PackageInstalled pkg => pkg -> String
35+
getPkgId pkg = case C.installedPackageId pkg of
36+
C.InstalledPackageId s -> s
37+
#endif
2938

3039
winOsFromConfig :: BuildConfig -> OS
3140
winOsFromConfig BuildConfig{..} = os
@@ -77,7 +86,7 @@ winOsFromConfig BuildConfig{..} = os
7786
whenM (doesFileExist confFile) $ do
7887
confStr <- liftIO . B.readFile $ confFile
7988
pkgInfo <- parseConfFile confFile (B8.unpack confStr)
80-
let (C.InstalledPackageId pkgid) = C.installedPackageId pkgInfo
89+
let pkgid = getPkgId pkgInfo
8190
-- need the long name of the package
8291
pkgDbConf = winGhcTargetPackageDbDir </> pkgid <.> "conf"
8392
command_ [] "cp" ["-p", confFile, pkgDbConf]

0 commit comments

Comments
 (0)