Commit b9981146 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Move cabalVersion, setupMessage and a bunch of paths into differnt modules

New Distribution.Simple.BuildPaths module similar to the .InstallDirs module
to hold all the paths and filenames used during a build.
It's currently somewhat of a miscellaneous collection.
parent 6267c075
......@@ -56,6 +56,7 @@ Library
Distribution.ParseUtils,
Distribution.Simple,
Distribution.Simple.Build,
Distribution.Simple.BuildPaths,
Distribution.Simple.Command,
Distribution.Simple.Compiler,
Distribution.Simple.Configure,
......
......@@ -88,7 +88,7 @@ import Distribution.PackageDescription
import Distribution.Simple.Setup
import Distribution.Simple.Command
import Distribution.Simple.Utils (die, rawSystemExit)
import Distribution.Simple.Utils (die, rawSystemExit, cabalVersion)
import Distribution.License (License(..))
import Distribution.Version (Version(..), showVersion)
......
......@@ -89,13 +89,14 @@ import Distribution.Simple.Configure(getPersistBuildConfig,
checkPersistBuildConfig,
configure, writePersistBuildConfig)
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..), distPref, srcPref)
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) )
import Distribution.Simple.BuildPaths ( distPref, srcPref)
import Distribution.Simple.Install (install)
import Distribution.Simple.Haddock (haddock, hscolour)
import Distribution.Simple.Utils
(die, notice, info, warn, chattyTry,
(die, notice, info, warn, setupMessage, chattyTry,
defaultPackageDesc, defaultHookedPackageDesc,
rawSystemExit)
rawSystemExit, cabalVersion )
import Distribution.Verbosity
import Language.Haskell.Extension
import Distribution.Version
......@@ -497,5 +498,5 @@ defaultRegHook pkg_descr localbuildinfo _ flags =
if hasLibs pkg_descr
then register pkg_descr localbuildinfo flags
else setupMessage verbosity
"Package contains no library to register:" pkg_descr
"Package contains no library to register:" (package pkg_descr)
where verbosity = fromFlag (regVerbose flags)
......@@ -48,8 +48,7 @@ module Distribution.Simple.Build (
import Distribution.Simple.Compiler ( Compiler(..), CompilerFlavor(..) )
import Distribution.PackageDescription
( PackageDescription(..), BuildInfo(..),
setupMessage, Executable(..), Library(..),
autogenModuleName )
Executable(..), Library(..) )
import Distribution.Package ( PackageIdentifier(..), showPackageId )
import Distribution.Simple.Setup ( CopyDest(..), BuildFlags(..),
MakefileFlags(..), fromFlag )
......@@ -58,9 +57,10 @@ import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..),
InstallDirs(..), absoluteInstallDirs,
prefixRelativeInstallDirs )
import Distribution.Simple.BuildPaths ( autogenModuleName )
import Distribution.Simple.Configure
( localBuildInfoFile )
import Distribution.Simple.Utils( createDirectoryIfMissingVerbose, die )
import Distribution.Simple.Utils( createDirectoryIfMissingVerbose, die, setupMessage )
import Distribution.System
import System.FilePath ( (</>), pathSeparator )
......@@ -88,7 +88,7 @@ build :: PackageDescription -- ^mostly information from the .cabal file
build pkg_descr lbi flags suffixes = do
let verbosity = fromFlag (buildVerbose flags)
initialBuildSteps pkg_descr lbi verbosity suffixes
setupMessage verbosity "Building" pkg_descr
setupMessage verbosity "Building" (package pkg_descr)
case compilerFlavor (compiler lbi) of
GHC -> GHC.build pkg_descr lbi verbosity
JHC -> JHC.build pkg_descr lbi verbosity
......@@ -106,7 +106,7 @@ makefile pkg_descr lbi flags suffixes = do
initialBuildSteps pkg_descr lbi verbosity suffixes
when (not (hasLibs pkg_descr)) $
die ("Makefile is only supported for libraries, currently.")
setupMessage verbosity "Generating Makefile" pkg_descr
setupMessage verbosity "Generating Makefile" (package pkg_descr)
case compilerFlavor (compiler lbi) of
GHC -> GHC.makefile pkg_descr lbi flags
_ -> die ("Generating a Makefile is not supported for this compiler.")
......
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.BuildPaths
-- Copyright : Isaac Jones 2003-2004,
-- Duncan Coutts 2008
--
-- Maintainer : Isaac Jones <ijones@syntaxpolice.org>
-- Stability : alpha
-- Portability : portable
--
-- A bunch of dirs, paths and file names used for intermediate build steps.
--
{- All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Isaac Jones nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.BuildPaths (
distPref, srcPref,
hscolourPref, haddockPref,
autogenModulesDir,
autogenModuleName,
haddockName,
mkLibName,
mkProfLibName,
mkSharedLibName,
exeExtension,
objExtension,
dllExtension,
) where
import System.FilePath (FilePath, (</>), (<.>))
import Distribution.Package (PackageIdentifier(..))
import Distribution.PackageDescription (PackageDescription(..))
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..))
import Distribution.Version (showVersion)
import Distribution.System (OS(..), os)
-- ---------------------------------------------------------------------------
-- Build directories and files
distPref :: FilePath
distPref = "dist"
srcPref :: FilePath
srcPref = distPref </> "src"
hscolourPref :: PackageDescription -> FilePath
hscolourPref = haddockPref
haddockPref :: PackageDescription -> FilePath
haddockPref pkg_descr
= foldl1 (</>) [distPref, "doc", "html", pkgName (package pkg_descr)]
-- |The directory in which we put auto-generated modules
autogenModulesDir :: LocalBuildInfo -> String
autogenModulesDir lbi = buildDir lbi </> "autogen"
-- |The name of the auto-generated module associated with a package
autogenModuleName :: PackageDescription -> String
autogenModuleName pkg_descr =
"Paths_" ++ map fixchar (pkgName (package pkg_descr))
where fixchar '-' = '_'
fixchar c = c
haddockName :: PackageDescription -> FilePath
haddockName pkg_descr = pkgName (package pkg_descr) <.> "haddock"
-- ---------------------------------------------------------------------------
-- Library file names
mkLibName :: FilePath -- ^file Prefix
-> String -- ^library name.
-> String
mkLibName pref lib = pref </> ("libHS" ++ lib ++ ".a")
mkProfLibName :: FilePath -- ^file Prefix
-> String -- ^library name.
-> String
mkProfLibName pref lib = mkLibName pref (lib++"_p")
-- Implement proper name mangling for dynamical shared objects
-- libHS<packagename>-<compilerFlavour><compilerVersion>
-- e.g. libHSbase-2.1-ghc6.6.1.so
mkSharedLibName :: FilePath -- ^file Prefix
-> String -- ^library name.
-> PackageIdentifier -- ^package identifier of the compiler
-> String
mkSharedLibName pref lib (PackageIdentifier compilerName compilerVersion)
= pref </> ("libHS" ++ lib ++ "-" ++ comp) <.> dllExtension
where comp = compilerName ++ showVersion compilerVersion
-- ------------------------------------------------------------
-- * Platform file extensions
-- ------------------------------------------------------------
-- ToDo: This should be determined via autoconf (AC_EXEEXT)
-- | Extension for executable files
-- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2)
exeExtension :: String
exeExtension = case os of
Windows _ -> "exe"
_ -> ""
-- ToDo: This should be determined via autoconf (AC_OBJEXT)
-- | Extension for object files. For GHC and NHC the extension is @\"o\"@.
-- Hugs uses either @\"o\"@ or @\"obj\"@ depending on the used C compiler.
objExtension :: String
objExtension = "o"
-- | Extension for dynamically linked (or shared) libraries
-- (typically @\"so\"@ on Unix and @\"dll\"@ on Windows)
dllExtension :: String
dllExtension = case os of
Windows _ -> "dll"
OSX -> "dylib"
_ -> "so"
......@@ -79,10 +79,12 @@ import Distribution.Simple.Setup
import Distribution.Simple.InstallDirs
( InstallDirs(..), defaultInstallDirs, combineInstallDirs )
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..), distPref, absoluteInstallDirs
( LocalBuildInfo(..), absoluteInstallDirs
, prefixRelativeInstallDirs )
import Distribution.Simple.BuildPaths
( distPref )
import Distribution.Simple.Utils
( die, warn, info, createDirectoryIfMissingVerbose )
( die, warn, info, setupMessage, createDirectoryIfMissingVerbose )
import Distribution.Simple.Register
( removeInstalledConfig )
import Distribution.System
......@@ -187,7 +189,7 @@ configure (pkg_descr0, pbi) cfg
= do let verbosity = fromFlag (configVerbose cfg)
setupMessage verbosity "Configuring"
(either packageDescription id pkg_descr0)
(package (either packageDescription id pkg_descr0))
createDirectoryIfMissingVerbose (lessVerbose verbosity) True distPref
......
......@@ -52,11 +52,12 @@ import Distribution.Simple.Setup ( MakefileFlags(..),
fromFlag, fromFlagOrDefault)
import Distribution.PackageDescription
( PackageDescription(..), BuildInfo(..),
withLib, setupMessage,
withLib,
Executable(..), withExe, Library(..),
libModules, hcOptions )
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..), autogenModulesDir )
( LocalBuildInfo(..) )
import Distribution.Simple.BuildPaths
import Distribution.Simple.Utils
import Distribution.Package ( PackageIdentifier(..), showPackageId,
parsePackageId )
......@@ -704,7 +705,7 @@ installLib verbosity lbi pref dynPref buildPref
Nothing -> case lookupProgram arProgram programConf of
Just ar -> do ifVanilla $ rawSystemProgram verbosity ar ["-s", libTargetLoc]
ifProf $ rawSystemProgram verbosity ar ["-s", profLibTargetLoc]
Nothing -> setupMessage verbosity "Warning: Unable to generate index for library (missing ranlib and ar)" pd
Nothing -> warn verbosity "Unable to generate index for library (missing ranlib and ar)"
return ()
where ifVanilla action = when (withVanillaLib lbi) (action >> return ())
ifProf action = when (withProfLib lbi) (action >> return ())
......
......@@ -63,10 +63,11 @@ import Distribution.Simple.InstallDirs (InstallDirs(..),
toPathTemplate, fromPathTemplate,
substPathTemplate,
initialPathTemplateEnv)
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..), hscolourPref,
haddockPref, distPref, autogenModulesDir )
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) )
import Distribution.Simple.BuildPaths ( distPref, haddockPref, haddockName,
hscolourPref, autogenModulesDir )
import Distribution.Simple.Utils (die, warn, notice, createDirectoryIfMissingVerbose,
moduleToFilePath, findFile)
moduleToFilePath, findFile, setupMessage)
import Distribution.Simple.Utils (rawSystemStdout)
import Distribution.Verbosity
......@@ -113,7 +114,7 @@ haddock pkg_descr lbi suffixes flags = do
createDirectoryIfMissingVerbose verbosity True $ haddockPref pkg_descr
preprocessSources pkg_descr lbi False verbosity suffixes
setupMessage verbosity "Running Haddock for" pkg_descr
setupMessage verbosity "Running Haddock for" (package pkg_descr)
let replaceLitExts = map ( (tmpDir </>) . (`replaceExtension` "hs") )
let showPkg = showPackageId (package pkg_descr)
......@@ -318,7 +319,7 @@ hscolour pkg_descr lbi suffixes flags = do
createDirectoryIfMissingVerbose verbosity True $ hscolourPref pkg_descr
preprocessSources pkg_descr lbi False verbosity suffixes
setupMessage verbosity "Running hscolour for" pkg_descr
setupMessage verbosity "Running hscolour for" (package pkg_descr)
let replaceDot = map (\c -> if c == '.' then '-' else c)
withLib pkg_descr () $ \lib -> when (isJust $ library pkg_descr) $ do
......
......@@ -58,10 +58,13 @@ import Distribution.Simple.PreProcess ( ppCpp, runSimplePreProcessor )
import Distribution.Simple.PreProcess.Unlit
( unlit )
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..), autogenModulesDir )
( LocalBuildInfo(..))
import Distribution.Simple.BuildPaths
( autogenModuleName, autogenModulesDir,
dllExtension )
import Distribution.Simple.Utils( createDirectoryIfMissingVerbose, dotToSep,
moduleToFilePath, die, info, notice,
smartCopySources, findFile, dllExtension )
smartCopySources, findFile )
import Language.Haskell.Extension
( Extension(..) )
import System.FilePath ( (</>), takeExtension, (<.>),
......
......@@ -47,9 +47,10 @@ module Distribution.Simple.Install (
import Distribution.PackageDescription (
PackageDescription(..), BuildInfo(..), Library(..),
hasLibs, withLib, hasExes, withExe, haddockName )
hasLibs, withLib, hasExes, withExe )
import Distribution.Simple.LocalBuildInfo (
LocalBuildInfo(..), InstallDirs(..), absoluteInstallDirs, haddockPref)
LocalBuildInfo(..), InstallDirs(..), absoluteInstallDirs)
import Distribution.Simple.BuildPaths (haddockName, haddockPref)
import Distribution.Simple.Utils (createDirectoryIfMissingVerbose,
copyFileVerbose, die, info, notice,
copyDirectoryRecursiveVerbose)
......
......@@ -50,8 +50,9 @@ import Distribution.PackageDescription
Executable(..), withExe, Library(..),
libModules, hcOptions )
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..),
autogenModulesDir )
( LocalBuildInfo(..) )
import Distribution.Simple.BuildPaths
( autogenModulesDir, exeExtension )
import Distribution.Simple.Compiler ( Compiler(..), CompilerFlavor(..), Flag,
PackageDB, extensionsToFlags )
import Language.Haskell.Extension (Extension(..))
......@@ -63,7 +64,7 @@ import Distribution.Version ( VersionRange(AnyVersion) )
import Distribution.Package ( PackageIdentifier(..), showPackageId,
parsePackageId )
import Distribution.Simple.Utils( createDirectoryIfMissingVerbose,
copyFileVerbose, exeExtension, die, info )
copyFileVerbose, die, info )
import System.FilePath ( (</>) )
import Distribution.Verbosity
import Distribution.Compat.ReadP
......
......@@ -52,6 +52,8 @@ import Distribution.PackageDescription
withLib, withExe, hcOptions )
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..) )
import Distribution.Simple.BuildPaths
( mkLibName, objExtension, exeExtension )
import Distribution.Simple.Compiler
( Compiler(..), CompilerFlavor(..), Flag, extensionsToFlags )
import Language.Haskell.Extension
......@@ -62,8 +64,7 @@ import Distribution.Simple.Program
nhcProgram, hmakeProgram, ldProgram, arProgram,
rawSystemProgramConf )
import Distribution.Simple.Utils
( die, info, moduleToFilePath, dotToSep,
mkLibName, objExtension, exeExtension,
( die, info, moduleToFilePath, dotToSep,
createDirectoryIfMissingVerbose, copyFileVerbose, smartCopySources )
import Distribution.Version
( Version(..), VersionRange(..), orLaterVersion )
......@@ -110,7 +111,8 @@ configure verbosity hcPath _hcPkgPath conf = do
-- | The flags for the supported extensions
nhcLanguageExtensions :: [(Extension, Flag)]
nhcLanguageExtensions =
-- NHC doesn't enforce the monomorphism restriction at all.
-- TODO: use -98 when no extensions are specified.
-- NHC doesn't enforce the monomorphism restriction at all.
[(NoMonomorphismRestriction, "")
,(ForeignFunctionInterface, "")
,(ExistentialQuantification, "")
......
......@@ -56,13 +56,13 @@ module Distribution.Simple.PreProcess (preprocessSources, knownSuffixHandlers,
import Distribution.Simple.PreProcess.Unlit (unlit)
import Distribution.PackageDescription (setupMessage, PackageDescription(..),
import Distribution.PackageDescription (PackageDescription(..),
BuildInfo(..), Executable(..), withExe,
Library(..), withLib, libModules)
import Distribution.Package (showPackageId)
import Distribution.Simple.Compiler (CompilerFlavor(..), Compiler(..), compilerVersion)
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..))
import Distribution.Simple.Utils (createDirectoryIfMissingVerbose, die,
import Distribution.Simple.Utils (createDirectoryIfMissingVerbose, die, setupMessage,
moduleToFilePath, moduleToFilePath2)
import Distribution.Simple.Program (Program(..), ConfiguredProgram(..),
lookupProgram, programPath,
......@@ -76,7 +76,7 @@ import Distribution.Verbosity
import Control.Monad (when, unless, join)
import Data.Maybe (fromMaybe)
import Data.List (nub)
import System.Directory (removeFile, getModificationTime)
import System.Directory (getModificationTime)
import System.Info (os, arch)
import System.FilePath (splitExtension, dropExtensions, (</>), (<.>),
takeDirectory, normalise)
......@@ -165,14 +165,14 @@ preprocessSources :: PackageDescription
preprocessSources pkg_descr lbi forSDist verbosity handlers = do
withLib pkg_descr () $ \ lib -> do
setupMessage verbosity "Preprocessing library" pkg_descr
setupMessage verbosity "Preprocessing library" (package pkg_descr)
let bi = libBuildInfo lib
let biHandlers = localHandlers bi
sequence_ [ preprocessModule (hsSourceDirs bi) (buildDir lbi) forSDist
modu verbosity builtinSuffixes biHandlers
| modu <- libModules pkg_descr]
unless (null (executables pkg_descr)) $
setupMessage verbosity "Preprocessing executables for" pkg_descr
setupMessage verbosity "Preprocessing executables for" (package pkg_descr)
withExe pkg_descr $ \ theExe -> do
let bi = buildInfo theExe
let biHandlers = localHandlers bi
......
......@@ -49,9 +49,10 @@ module Distribution.Simple.Register (
removeRegScripts,
) where
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), distPref,
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),
InstallDirs(..),
absoluteInstallDirs)
import Distribution.Simple.BuildPaths (distPref, haddockName)
import Distribution.Simple.Compiler (CompilerFlavor(..), Compiler(..),
PackageDB(..))
import Distribution.Simple.Program (ConfiguredProgram, programPath,
......@@ -59,8 +60,8 @@ import Distribution.Simple.Program (ConfiguredProgram, programPath,
lookupProgram, ghcPkgProgram)
import Distribution.Simple.Setup (RegisterFlags(..), CopyDest(..),
fromFlag, fromFlagOrDefault)
import Distribution.PackageDescription (setupMessage, PackageDescription(..),
BuildInfo(..), Library(..), haddockName)
import Distribution.PackageDescription (PackageDescription(..),
BuildInfo(..), Library(..))
import Distribution.Package (PackageIdentifier(..), showPackageId)
import Distribution.Verbosity
import Distribution.InstalledPackageInfo
......@@ -68,7 +69,7 @@ import Distribution.InstalledPackageInfo
emptyInstalledPackageInfo)
import qualified Distribution.InstalledPackageInfo as IPI
import Distribution.Simple.Utils (createDirectoryIfMissingVerbose,
copyFileVerbose, die, info)
copyFileVerbose, die, info, setupMessage)
import Distribution.System
import System.FilePath ((</>), (<.>), isAbsolute)
......@@ -100,7 +101,7 @@ register :: PackageDescription -> LocalBuildInfo
-> IO ()
register pkg_descr lbi regFlags
| isNothing (library pkg_descr) = do
setupMessage (fromFlag $ regVerbose regFlags) "No package to register" pkg_descr
setupMessage (fromFlag $ regVerbose regFlags) "No package to register" (package pkg_descr)
return ()
| otherwise = do
let isWindows = case os of Windows _ -> True; _ -> False
......@@ -117,7 +118,7 @@ register pkg_descr lbi regFlags
| genScript = "Writing registration script: "
++ regScriptLocation ++ " for"
| otherwise = "Registering"
setupMessage verbosity message pkg_descr
setupMessage verbosity message (package pkg_descr)
case compilerFlavor (compiler lbi) of
GHC -> do
......@@ -277,7 +278,7 @@ unregister pkg_descr lbi regFlags = do
verbosity = fromFlag (regVerbose regFlags)
packageDB = fromFlagOrDefault (withPackageDB lbi) (regPackageDB regFlags)
installDirs = absoluteInstallDirs pkg_descr lbi NoCopyDest
setupMessage verbosity "Unregistering" pkg_descr
setupMessage verbosity "Unregistering" (package pkg_descr)
case compilerFlavor (compiler lbi) of
GHC -> do
config_flags <- case packageDB of
......
......@@ -55,12 +55,12 @@ module Distribution.Simple.SrcDist (
import Distribution.PackageDescription
(PackageDescription(..), BuildInfo(..), Executable(..), Library(..),
withLib, withExe, setupMessage)
withLib, withExe)
import Distribution.PackageDescription.QA
import Distribution.Package (showPackageId, PackageIdentifier(pkgVersion))
import Distribution.Version (Version(versionBranch), VersionRange(AnyVersion))
import Distribution.Simple.Utils (createDirectoryIfMissingVerbose,
die, warn, notice, defaultPackageDesc,
die, warn, notice, setupMessage, defaultPackageDesc,
findFile, findFileWithExtension,
dotToSep, copyFiles, copyFileVerbose)
import Distribution.Simple.Setup (SDistFlags(..), fromFlag)
......@@ -130,7 +130,7 @@ prepareTree :: PackageDescription -- ^info from the cabal file
-> IO FilePath
prepareTree pkg_descr verbosity mb_lbi snapshot tmpDir pps date = do
setupMessage verbosity "Building source dist for" pkg_descr
setupMessage verbosity "Building source dist for" (package pkg_descr)
ex <- doesDirectoryExist tmpDir
when ex (die $ "Source distribution already in place. please move: " ++ tmpDir)
let targetDir = tmpDir </> (nameVersion pkg_descr)
......
......@@ -45,9 +45,10 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.Utils (
cabalVersion,
die,
dieWithLocation,
warn, notice, info, debug,
warn, notice, setupMessage, info, debug,
chattyTry,
breaks,
wrapText,
......@@ -127,6 +128,14 @@ import System.IO (Handle, hClose)
import Distribution.Compat.TempFile (openTempFile)
import Distribution.Verbosity
-- We only get our own version number when we're building with ourselves
cabalVersion :: Version
#ifdef CABAL_VERSION
cabalVersion = Version [CABAL_VERSION] []
#else
cabalVersion = error "Cabal was not bootstrapped correctly"
#endif
-- ------------------------------------------------------------------------------- Utils for setup
dieWithLocation :: FilePath -> (Maybe Int) -> String -> IO a
......@@ -162,6 +171,10 @@ notice verbosity msg =
when (verbosity >= normal) $
putStrLn msg
setupMessage :: Verbosity -> String -> PackageIdentifier -> IO ()
setupMessage verbosity msg pkgid =
notice verbosity (msg ++ ' ':showPackageId pkgid ++ "...")
-- | More detail on the operation of some action.
--
-- We display these messages when the verbosity level is 'verbose'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment