-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathInternal.hs
More file actions
36 lines (32 loc) · 1.26 KB
/
Internal.hs
File metadata and controls
36 lines (32 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{-# LANGUAGE CPP #-}
module Internal where
import Distribution.Simple
#if MIN_VERSION_Cabal(3,14,0)
import Distribution.Utils.Path (getSymbolicPath, makeSymbolicPath)
#endif
#if MIN_VERSION_Cabal(2,4,0)
import Distribution.Simple.Glob (matchDirFileGlob)
import Distribution.Types.PackageDescription
#else
import qualified Distribution.Simple.Utils as Utils (matchFileGlob)
import Distribution.PackageDescription
#endif
import Distribution.Verbosity (Verbosity)
fromPackageName :: PackageName -> String
#if MIN_VERSION_Cabal(2,0,0)
fromPackageName = unPackageName
#else
fromPackageName (PackageName s) = s
#endif
matchFileGlob :: Verbosity -> PackageDescription -> FilePath -> IO [FilePath]
#if MIN_VERSION_Cabal(3,14,0)
-- | Modified to conform to newest cabal signature
matchFileGlob verb descr = toFilePath . matchDirFileGlob verb (specVersion descr) (Just (makeSymbolicPath ".")) . makeSymbolicPath
where
toFilePath = fmap . fmap $ getSymbolicPath
#elif MIN_VERSION_Cabal(2,4,0)
-- | Newer versions of Cabal have removed this function in favour of more configurable implementation
matchFileGlob verb descr = matchDirFileGlob verb (specVersion descr) "."
#else
matchFileGlob _ _ = Utils.matchFileGlob
#endif