Cabal-1.3.4: A framework for packaging Haskell softwareContentsIndex
Distribution.Simple.Utils
Portabilityportable
Stabilityalpha
MaintainerIsaac Jones <ijones@syntaxpolice.org>
Description
Explanation: Misc. Utilities, especially file-related utilities. Stuff used by multiple modules that doesn't fit elsewhere.
Synopsis
cabalVersion :: Version
die :: String -> IO a
dieWithLocation :: FilePath -> Maybe Int -> String -> IO a
warn :: Verbosity -> String -> IO ()
notice :: Verbosity -> String -> IO ()
setupMessage :: Verbosity -> String -> PackageIdentifier -> IO ()
info :: Verbosity -> String -> IO ()
debug :: Verbosity -> String -> IO ()
chattyTry :: String -> IO () -> IO ()
breaks :: (a -> Bool) -> [a] -> [[a]]
wrapText :: Int -> [String] -> [String]
rawSystemExit :: Verbosity -> FilePath -> [String] -> IO ()
rawSystemStdout :: Verbosity -> FilePath -> [String] -> IO String
rawSystemStdout' :: Verbosity -> FilePath -> [String] -> IO (String, ExitCode)
maybeExit :: IO ExitCode -> IO ()
xargs :: Int -> ([String] -> IO ()) -> [String] -> [String] -> IO ()
smartCopySources :: Verbosity -> [FilePath] -> FilePath -> [String] -> [String] -> IO ()
createDirectoryIfMissingVerbose :: Verbosity -> Bool -> FilePath -> IO ()
copyFileVerbose :: Verbosity -> FilePath -> FilePath -> IO ()
copyDirectoryRecursiveVerbose :: Verbosity -> FilePath -> FilePath -> IO ()
copyFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)] -> IO ()
currentDir :: FilePath
dotToSep :: String -> String
findFile :: [FilePath] -> FilePath -> IO FilePath
findFileWithExtension :: [String] -> [FilePath] -> FilePath -> IO (Maybe FilePath)
findFileWithExtension' :: [String] -> [FilePath] -> FilePath -> IO (Maybe (FilePath, FilePath))
withTempFile :: FilePath -> String -> (FilePath -> Handle -> IO a) -> IO a
defaultPackageDesc :: Verbosity -> IO FilePath
findPackageDesc :: Verbosity -> FilePath -> IO FilePath
defaultHookedPackageDesc :: IO (Maybe FilePath)
findHookedPackageDesc :: FilePath -> IO (Maybe FilePath)
Documentation
cabalVersion :: Version
die :: String -> IO a
dieWithLocation :: FilePath -> Maybe Int -> String -> IO a
warn :: Verbosity -> String -> IO ()

Non fatal conditions that may be indicative of an error or problem.

We display these at the normal verbosity level.

notice :: Verbosity -> String -> IO ()

Useful status messages.

We display these at the normal verbosity level.

This is for the ordinary helpful status messages that users see. Just enough information to know that things are working but not floods of detail.

setupMessage :: Verbosity -> String -> PackageIdentifier -> IO ()
info :: Verbosity -> String -> IO ()

More detail on the operation of some action.

We display these messages when the verbosity level is verbose

debug :: Verbosity -> String -> IO ()

Detailed internal debugging information

We display these messages when the verbosity level is deafening

chattyTry
:: Stringa description of the action we were attempting
-> IO ()the action itself
-> IO ()
Perform an IO action, catching any IO exceptions and printing an error if one occurs.
breaks :: (a -> Bool) -> [a] -> [[a]]
wrapText :: Int -> [String] -> [String]
rawSystemExit :: Verbosity -> FilePath -> [String] -> IO ()
rawSystemStdout :: Verbosity -> FilePath -> [String] -> IO String
rawSystemStdout' :: Verbosity -> FilePath -> [String] -> IO (String, ExitCode)
maybeExit :: IO ExitCode -> IO ()
xargs :: Int -> ([String] -> IO ()) -> [String] -> [String] -> IO ()

Like the unix xargs program. Useful for when we've got very long command lines that might overflow an OS limit on command line length and so you need to invoke a command multiple times to get all the args in.

Use it with either of the rawSystem variants above. For example:

 xargs (32*1024) (rawSystemExit verbosity) prog fixedArgs bigArgs
smartCopySources
:: Verbosityverbosity
-> [FilePath]build prefix (location of objects)
-> FilePathTarget directory
-> [String]Modules
-> [String]search suffixes
-> IO ()
Copy the source files into the right directory. Looks in the build prefix for files that look like the input modules, based on the input search suffixes. It copies the files into the target directory.
createDirectoryIfMissingVerbose :: Verbosity -> Bool -> FilePath -> IO ()
copyFileVerbose :: Verbosity -> FilePath -> FilePath -> IO ()
copyDirectoryRecursiveVerbose :: Verbosity -> FilePath -> FilePath -> IO ()
copyFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)] -> IO ()

Copies a bunch of files to a target directory, preserving the directory structure in the target location. The target directories are created if they do not exist.

The files are identified by a pair of base directory and a path relative to that base. It is only the relative part that is preserved in the destination.

For example:

 copyFiles normal "dist/src"
    [("", "src/Foo.hs"), ("dist/build/", "src/Bar.hs")]

This would copy "src/Foo.hs" to "dist/src/src/Foo.hs" and copy "dist/build/src/Bar.hs" to "dist/src/src/Bar.hs".

This operation is not atomic. Any IO failure during the copy (including any missing source files) leaves the target in an unknown state so it is best to use it with a freshly created directory so that it can be simply deleted if anything goes wrong.

currentDir :: FilePath
The path name that represents the current directory. In Unix, it's ".", but this is system-specific. (E.g. AmigaOS uses the empty string "" for the current directory.)
dotToSep :: String -> String
findFile
:: [FilePath]search locations
-> FilePathFile Name
-> IO FilePath
findFileWithExtension :: [String] -> [FilePath] -> FilePath -> IO (Maybe FilePath)
findFileWithExtension' :: [String] -> [FilePath] -> FilePath -> IO (Maybe (FilePath, FilePath))
withTempFile
:: FilePathTemp dir to create the file in
-> StringFile name template. See openTempFile.
-> (FilePath -> Handle -> IO a)
-> IO a
Use a temporary filename that doesn't already exist.
defaultPackageDesc :: Verbosity -> IO FilePath
Package description file (pkgname.cabal)
findPackageDesc
:: VerbosityVerbosity
-> FilePathWhere to look
-> IO FilePathpkgname.cabal
Find a package description file in the given directory. Looks for .cabal files.
defaultHookedPackageDesc :: IO (Maybe FilePath)
Optional auxiliary package information file (pkgname.buildinfo)
findHookedPackageDesc
:: FilePathDirectory to search
-> IO (Maybe FilePath)dir/pkgname.buildinfo, if present
Find auxiliary package information in the given directory. Looks for .buildinfo files.
Produced by Haddock version 0.9