Skip to content

Commit

Permalink
Remove matchFileGlob.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
quasicomputational authored and 23Skidoo committed Jun 28, 2018
1 parent 2e78642 commit 2b7be35
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions Cabal/Distribution/Simple/Glob.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module Distribution.Simple.Glob (
GlobSyntaxError(..),
GlobResult(..),
globMatches,
matchFileGlob,
matchDirFileGlob,
matchDirFileGlob',
fileGlobMatches,
Expand Down Expand Up @@ -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]

This comment has been minimized.

Copy link
@phadej

phadej Mar 14, 2019

Collaborator

Ooh. We should use CabalSpecVersion here. @hvr May I do the change for 3.0 still?

Expand Down
2 changes: 1 addition & 1 deletion Cabal/Distribution/Simple/Haddock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

-- ------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions Cabal/Distribution/Simple/SrcDist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2b7be35

Please sign in to comment.