From 9668baf2705664ee3f7f0c5db33216534748b4ae Mon Sep 17 00:00:00 2001 From: quasicomputational Date: Wed, 27 Jun 2018 10:19:01 +0100 Subject: [PATCH] Remove matchFileGlob. This was only a convenience function, but its use could obscure how it is introducing a dependency on the CWD. By removing it, the "." argument to `matchDirFileGlob` is explicit. Any external code using `matchFileGlob` would have needed to be changed as #5284 changed its signature and the module it lives in; it is not much more of a burden to switch to `matchDirFileGlob` at the same time. --- Cabal/Distribution/Simple/Glob.hs | 4 ---- Cabal/Distribution/Simple/Haddock.hs | 2 +- Cabal/Distribution/Simple/SrcDist.hs | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Cabal/Distribution/Simple/Glob.hs b/Cabal/Distribution/Simple/Glob.hs index c033c3198e6..629f45cf60a 100644 --- a/Cabal/Distribution/Simple/Glob.hs +++ b/Cabal/Distribution/Simple/Glob.hs @@ -18,7 +18,6 @@ module Distribution.Simple.Glob ( GlobSyntaxError(..), GlobResult(..), globMatches, - matchFileGlob, matchDirFileGlob, matchDirFileGlob', fileGlobMatches, @@ -193,9 +192,6 @@ parseFileGlob version filepath = case reverse (splitDirectories filepath) of | version >= mkVersion [2,4] = MultiDotEnabled | otherwise = MultiDotDisabled -matchFileGlob :: Verbosity -> Version -> FilePath -> IO [GlobResult FilePath] -matchFileGlob verbosity version = matchDirFileGlob verbosity version "." - -- | Like 'matchDirFileGlob'', but will 'die'' when the glob matches -- no files. matchDirFileGlob :: Verbosity -> Version -> FilePath -> FilePath -> IO [GlobResult FilePath] diff --git a/Cabal/Distribution/Simple/Haddock.hs b/Cabal/Distribution/Simple/Haddock.hs index 656bffe4e5c..7f2495ecf16 100644 --- a/Cabal/Distribution/Simple/Haddock.hs +++ b/Cabal/Distribution/Simple/Haddock.hs @@ -306,7 +306,7 @@ haddock pkg_descr lbi suffixes flags' = do CBench _ -> (when (flag haddockBenchmarks) $ smsg >> doExe component) >> return index for_ (extraDocFiles pkg_descr) $ \ fpath -> do - files <- fmap globMatches $ matchFileGlob verbosity (specVersion pkg_descr) fpath + files <- fmap globMatches $ matchDirFileGlob verbosity (specVersion pkg_descr) "." fpath for_ files $ copyFileTo verbosity (unDir $ argOutputDir commonArgs) -- ------------------------------------------------------------------------------ diff --git a/Cabal/Distribution/Simple/SrcDist.hs b/Cabal/Distribution/Simple/SrcDist.hs index e14db820c4a..06560164b75 100644 --- a/Cabal/Distribution/Simple/SrcDist.hs +++ b/Cabal/Distribution/Simple/SrcDist.hs @@ -149,7 +149,7 @@ listPackageSourcesMaybeExecutable verbosity pkg_descr = -- Extra source files. fmap concat . for (extraSrcFiles pkg_descr) $ \fpath -> fmap globMatches $ - matchFileGlob verbosity (specVersion pkg_descr) fpath + matchDirFileGlob verbosity (specVersion pkg_descr) "." fpath -- | List those source files that should be copied with ordinary permissions. listPackageSourcesOrdinary :: Verbosity @@ -223,7 +223,7 @@ listPackageSourcesOrdinary verbosity pkg_descr pps = , fmap concat . for (extraDocFiles pkg_descr) $ \ filename -> fmap globMatches $ - matchFileGlob verbosity (specVersion pkg_descr) filename + matchDirFileGlob verbosity (specVersion pkg_descr) "." filename -- License file(s). , return (licenseFiles pkg_descr)