aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Shared/Common.hs
diff options
context:
space:
mode:
authorJulian Ospald <hasufell@posteo.de>2018-04-05 10:48:31 +0200
committerDaniel Gröber <dxld@darkboxed.org>2018-04-05 10:48:31 +0200
commitae568d1008e2dc9980cef86e8a18c7dfaf25fc8d (patch)
tree62fc443ae4c809c5de3f655dabfa9ba1d92cf1de /src/CabalHelper/Shared/Common.hs
parent0b49461766119598e1ca0721d73e12920a413eaf (diff)
Fix building with Cabal 2.2 (#53)
Diffstat (limited to 'src/CabalHelper/Shared/Common.hs')
-rw-r--r--src/CabalHelper/Shared/Common.hs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/CabalHelper/Shared/Common.hs b/src/CabalHelper/Shared/Common.hs
index 6a12d86..2699496 100644
--- a/src/CabalHelper/Shared/Common.hs
+++ b/src/CabalHelper/Shared/Common.hs
@@ -19,9 +19,14 @@ Description : Shared utility functions
License : AGPL-3
-}
-{-# LANGUAGE DeriveDataTypeable, OverloadedStrings #-}
+{-# LANGUAGE CPP, DeriveDataTypeable, OverloadedStrings #-}
module CabalHelper.Shared.Common where
+#ifdef MIN_VERSION_Cabal
+#undef CH_MIN_VERSION_Cabal
+#define CH_MIN_VERSION_Cabal MIN_VERSION_Cabal
+#endif
+
import Control.Applicative
import Control.Exception as E
import Control.Monad
@@ -33,6 +38,11 @@ import Data.Typeable
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
+#if CH_MIN_VERSION_Cabal(2,2,0)
+import qualified Distribution.PackageDescription.Parsec as P
+#else
+import qualified Distribution.PackageDescription.Parse as P
+#endif
import System.Environment
import System.IO
import qualified System.Info
@@ -130,3 +140,10 @@ replace n r hs' = go "" hs'
reverse acc ++ r ++ drop (length n) h
go acc (h:hs) = go (h:acc) hs
go acc [] = reverse acc
+
+
+#if CH_MIN_VERSION_Cabal(2,2,0)
+readPackageDescription = P.readGenericPackageDescription
+#else
+readPackageDescription = P.readPackageDescription
+#endif