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

Add Text instances for PackageIdentifier and Dependency

And change all uses.
parent 66bb76be
......@@ -62,14 +62,13 @@ import Distribution.ParseUtils (
showFreeText)
import Distribution.License ( License(..) )
import Distribution.Package
( PackageIdentifier(..), packageName, packageVersion
, showPackageId, parsePackageId )
( PackageIdentifier(..), packageName, packageVersion )
import qualified Distribution.Package as Package
( Package(..), PackageFixedDeps(..) )
import Distribution.Version
( Version(..) )
import Distribution.Text
( Text(disp) )
( Text(disp, parse) )
import qualified Distribution.Compat.ReadP as ReadP
import Control.Monad ( foldM )
......@@ -270,7 +269,7 @@ installedFieldDescrs = [
showFilePath parseFilePathQ
includes (\xs pkg -> pkg{includes=xs})
, listField "depends"
(text.showPackageId) parsePackageId'
disp parsePackageId'
depends (\xs pkg -> pkg{depends=xs})
, listField "hugs-options"
showToken parseTokenQ
......@@ -296,4 +295,4 @@ installedFieldDescrs = [
]
parsePackageId' :: ReadP.ReadP [PackageIdentifier] PackageIdentifier
parsePackageId' = parseQuoted parsePackageId ReadP.<++ parsePackageId
parsePackageId' = parseQuoted parse ReadP.<++ parse
......@@ -42,24 +42,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Package (
-- * Package ids
PackageIdentifier(..),
showPackageId, parsePackageId, parsePackageName,
parsePackageName,
-- * Package dependencies
Dependency(..),
showDependency, parseDependency,
-- * Package classes
Package(..), packageName, packageVersion,
PackageFixedDeps(..),
) where
import Distribution.Version
import Distribution.Text
( Text(..), display )
import Distribution.Compat.ReadP as ReadP
import qualified Text.PrettyPrint as Pretty
import Text.PrettyPrint ((<+>))
import Data.Char ( isDigit, isAlphaNum )
import Distribution.Version (Version(..), VersionRange(AnyVersion))
import Distribution.Text (Text(..))
import qualified Distribution.Compat.ReadP as Parse
import Distribution.Compat.ReadP ((<++))
import qualified Text.PrettyPrint as Disp
import Text.PrettyPrint ((<>), (<+>))
import qualified Data.Char as Char ( isDigit, isAlphaNum )
import Data.List ( intersperse )
-- | The name and version of a package.
......@@ -70,28 +70,25 @@ data PackageIdentifier
}
deriving (Read, Show, Eq, Ord)
-- |Creates a string like foo-1.2
showPackageId :: PackageIdentifier -> String
showPackageId (PackageIdentifier n (Version [] _)) = n -- if no version, don't show version.
showPackageId pkgid =
pkgName pkgid ++ '-': display (packageVersion pkgid)
instance Text PackageIdentifier where
disp (PackageIdentifier n v) = case v of
Version [] _ -> Disp.text n -- if no version, don't show version.
_ -> Disp.text n <> Disp.char '-' <> disp v
parse = do
n <- parsePackageName
v <- (Parse.char '-' >> parse) <++ return (Version [] [])
return (PackageIdentifier n v)
parsePackageName :: ReadP r String
parsePackageName = do ns <- sepBy1 component (char '-')
parsePackageName :: Parse.ReadP r String
parsePackageName = do ns <- Parse.sepBy1 component (Parse.char '-')
return (concat (intersperse "-" ns))
where component = do
cs <- munch1 isAlphaNum
if all isDigit cs then pfail else return cs
cs <- Parse.munch1 Char.isAlphaNum
if all Char.isDigit cs then Parse.pfail else return cs
-- each component must contain an alphabetic character, to avoid
-- ambiguity in identifiers like foo-1 (the 1 is the version number).
-- |A package ID looks like foo-1.2.
parsePackageId :: ReadP r PackageIdentifier
parsePackageId = do
n <- parsePackageName
v <- (ReadP.char '-' >> parse) <++ return (Version [] [])
return PackageIdentifier{pkgName=n,pkgVersion=v}
-- ------------------------------------------------------------
-- * Package dependencies
-- ------------------------------------------------------------
......@@ -99,16 +96,15 @@ parsePackageId = do
data Dependency = Dependency String VersionRange
deriving (Read, Show, Eq)
showDependency :: Dependency -> Pretty.Doc
showDependency (Dependency name ver) =
Pretty.text name <+> disp ver
instance Text Dependency where
disp (Dependency name ver) =
Disp.text name <+> disp ver
parseDependency :: ReadP r Dependency
parseDependency = do name <- parsePackageName
skipSpaces
parse = do name <- parsePackageName
Parse.skipSpaces
ver <- parse <++ return AnyVersion
skipSpaces
return $ Dependency name ver
Parse.skipSpaces
return (Dependency name ver)
-- | Class of things that can be identified by a 'PackageIdentifier'
--
......
......@@ -72,9 +72,8 @@ import Distribution.Compat.ReadP hiding (get)
import Distribution.ParseUtils
import Distribution.PackageDescription
import Distribution.Package
( PackageIdentifier(..), packageName, packageVersion
, parsePackageName
, Dependency(..), showDependency, parseDependency )
( PackageIdentifier(..), packageName, packageVersion, parsePackageName
, Dependency(..) )
import Distribution.Version
( isAnyVersion )
import Distribution.Verbosity (Verbosity)
......@@ -114,7 +113,7 @@ pkgDescrFieldDescrs =
showFreeText (munch (const True))
maintainer (\val pkg -> pkg{maintainer=val})
, commaListField "build-depends"
showDependency parseDependency
disp parse
buildDepends (\xs pkg -> pkg{buildDepends=xs})
, simpleField "stability"
showFreeText (munch (const True))
......@@ -206,7 +205,7 @@ binfoFieldDescrs =
disp parse
buildable (\val binfo -> binfo{buildable=val})
, commaListField "build-tools"
showDependency parseBuildTool
disp parseBuildTool
buildTools (\xs binfo -> binfo{buildTools=xs})
, listField "cpp-options"
showToken parseTokenQ
......@@ -218,7 +217,7 @@ binfoFieldDescrs =
showToken parseTokenQ
ldOptions (\val binfo -> binfo{ldOptions=val})
, commaListField "pkgconfig-depends"
showDependency parsePkgconfigDependency
disp parsePkgconfigDependency
pkgconfigDepends (\xs binfo -> binfo{pkgconfigDepends=xs})
, listField "frameworks"
showToken parseTokenQ
......@@ -351,7 +350,7 @@ constraintFieldNames = ["build-depends"]
-- field descriptor.
parseConstraint :: Field -> ParseResult [Dependency]
parseConstraint (F l n v)
| n == "build-depends" = runP l n (parseCommaList parseDependency) v
| n == "build-depends" = runP l n (parseCommaList parse) v
parseConstraint f = bug $ "Constraint was expected (got: " ++ show f ++ ")"
{-
......
......@@ -51,7 +51,7 @@ import Distribution.PackageDescription
( PackageDescription(..), BuildInfo(..),
Executable(..), Library(..) )
import Distribution.Package
( packageVersion, showPackageId, Package(..) )
( Package(..), packageVersion )
import Distribution.Simple.Setup ( CopyDest(..), BuildFlags(..),
MakefileFlags(..), fromFlag )
import Distribution.Simple.PreProcess ( preprocessSources, PPSuffixHandler )
......@@ -79,6 +79,8 @@ import qualified Distribution.Simple.Hugs as Hugs
import Distribution.PackageDescription (hasLibs)
import Distribution.Verbosity
import Distribution.Text
( display )
-- -----------------------------------------------------------------------------
-- |Build the libraries and executables in this package.
......@@ -126,7 +128,7 @@ initialBuildSteps pkg_descr lbi verbosity suffixes = do
map libBuildInfo (maybeToList (library pkg_descr)) ++
map buildInfo (executables pkg_descr)
unless (any buildable buildInfos) $ do
let name = showPackageId (packageId pkg_descr)
let name = display (packageId pkg_descr)
die ("Package " ++ name ++ " can't be built on this system.")
createDirectoryIfMissingVerbose verbosity True (buildDir lbi)
......
......@@ -63,7 +63,7 @@ module Distribution.Simple.BuildPaths (
import System.FilePath (FilePath, (</>), (<.>))
import Distribution.Package
( PackageIdentifier(pkgName), packageName, showPackageId )
( PackageIdentifier(pkgName), packageName )
import Distribution.Compiler
( CompilerId(..), showCompilerFlavor )
import Distribution.PackageDescription (PackageDescription)
......@@ -107,7 +107,7 @@ haddockName pkg_descr = packageName pkg_descr <.> "haddock"
-- Library file names
mkLibName :: PackageIdentifier -> String
mkLibName lib = "libHS" ++ showPackageId lib <.> "a"
mkLibName lib = "libHS" ++ display lib <.> "a"
mkProfLibName :: PackageIdentifier -> String
mkProfLibName lib = mkLibName lib { pkgName = pkgName lib ++ "_p" }
......@@ -117,7 +117,7 @@ mkProfLibName lib = mkLibName lib { pkgName = pkgName lib ++ "_p" }
-- e.g. libHSbase-2.1-ghc6.6.1.so
mkSharedLibName :: PackageIdentifier -> CompilerId -> String
mkSharedLibName lib (CompilerId compilerFlavor compilerVersion)
= "libHS" ++ showPackageId lib ++ "-" ++ comp <.> dllExtension
= "libHS" ++ display lib ++ "-" ++ comp <.> dllExtension
where comp = showCompilerFlavor compilerFlavor
++ display compilerVersion
......
......@@ -59,8 +59,7 @@ import Distribution.Simple.Compiler
, showCompilerId, unsupportedExtensions, PackageDB(..) )
import Distribution.Package
( PackageIdentifier(PackageIdentifier), packageVersion, Package(..)
, showPackageId, parsePackageId
, Dependency(..), showDependency )
, Dependency(Dependency) )
import Distribution.InstalledPackageInfo
( InstalledPackageInfo, emptyInstalledPackageInfo )
import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo
......@@ -75,8 +74,6 @@ import Distribution.PackageDescription.Configuration
( finalizePackageDescription )
import Distribution.PackageDescription.Check
( PackageCheck(..), checkPackage, checkPackageFiles )
import Distribution.Compat.ReadP
( readP_to_S )
import Distribution.Simple.Program
( Program(..), ProgramLocation(..), ConfiguredProgram(..)
, ProgramConfiguration, defaultProgramConfiguration
......@@ -131,7 +128,7 @@ import qualified System.Info
import System.IO
( hPutStrLn, stderr, hGetContents, openFile, hClose, IOMode(ReadMode) )
import Distribution.Text
( display, simpleParse )
( Text(disp), display, simpleParse )
import Text.PrettyPrint.HughesPJ
( comma, punctuate, render, nest, sep )
......@@ -171,14 +168,14 @@ tryGetConfigStateFile filename = do
badVersion cabalId compilerId
= "You need to re-run the 'configure' command. "
++ "The version of Cabal being used has changed (was "
++ showPackageId cabalId ++ ", now "
++ showPackageId currentCabalId ++ ")."
++ display cabalId ++ ", now "
++ display currentCabalId ++ ")."
++ badcompiler compilerId
badcompiler compilerId | compilerId == currentCompilerId = ""
| otherwise
= " Additionally the compiler is different (was "
++ showPackageId compilerId ++ ", now "
++ showPackageId currentCompilerId
++ display compilerId ++ ", now "
++ display currentCompilerId
++ ") which is probably the cause of the problem."
-- internal function
......@@ -211,9 +208,9 @@ writePersistBuildConfig lbi = do
showHeader :: PackageIdentifier -> String
showHeader pkgid =
"Saved package config for " ++ showPackageId pkgid
++ " written by " ++ showPackageId currentCabalId
++ " using " ++ showPackageId currentCompilerId
"Saved package config for " ++ display pkgid
++ " written by " ++ display currentCabalId
++ " using " ++ display currentCompilerId
where
currentCabalId :: PackageIdentifier
......@@ -229,17 +226,14 @@ parseHeader :: String -> Maybe (PackageIdentifier, PackageIdentifier)
parseHeader header = case words header of
["Saved", "package", "config", "for", pkgid,
"written", "by", cabalid, "using", compilerid]
-> case (readPackageId pkgid,
readPackageId cabalid,
readPackageId compilerid) of
-> case (simpleParse pkgid :: Maybe PackageIdentifier,
simpleParse cabalid,
simpleParse compilerid) of
(Just _,
Just cabalid',
Just compilerid') -> Just (cabalid', compilerid')
_ -> Nothing
_ -> Nothing
where readPackageId str = case readP_to_S parsePackageId str of
[] -> Nothing
ok -> Just (fst (last ok))
-- |Check that localBuildInfoFile is up-to-date with respect to the
-- .cabal file.
......@@ -306,7 +300,7 @@ configure (pkg_descr0, pbi) cfg
Left missing ->
die $ "At least the following dependencies are missing:\n"
++ (render . nest 4 . sep . punctuate comma $
map showDependency missing)
map disp missing)
Right pd -> return (pd,[])
-- add extra include/lib dirs as specified in cfg
......@@ -346,9 +340,9 @@ configure (pkg_descr0, pbi) cfg
++ " packages they depend on are missing. These broken "
++ "packages must be rebuilt before they can be used.\n"
++ unlines [ "package "
++ showPackageId (packageId pkg)
++ display (packageId pkg)
++ " is broken due to missing package "
++ intercalate ", " (map showPackageId deps)
++ intercalate ", " (map display deps)
| (pkg, deps) <- broken ]
let pseudoTopPkg = emptyInstalledPackageInfo {
......@@ -361,8 +355,8 @@ configure (pkg_descr0, pbi) cfg
warn verbosity $
"This package indirectly depends on multiple versions of the same "
++ "package. This is highly likely to cause a compile failure.\n"
++ unlines [ "package " ++ showPackageId pkg ++ " requires "
++ showPackageId (PackageIdentifier name ver)
++ unlines [ "package " ++ display pkg ++ " requires "
++ display (PackageIdentifier name ver)
| (name, uses) <- inconsistencies
, (pkg, ver) <- uses ]
......@@ -498,7 +492,7 @@ configDependency verbosity index dep@(Dependency pkgname vrange) =
pkgs -> do let pkgid = maximumBy (comparing packageVersion) (map packageId pkgs)
info verbosity $ "Dependency " ++ pkgname
++ display vrange
++ ": using " ++ showPackageId pkgid
++ ": using " ++ display pkgid
return pkgid
getInstalledPackages :: Verbosity -> Compiler -> PackageDB -> ProgramConfiguration
......
......@@ -66,7 +66,7 @@ import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.BuildPaths
import Distribution.Simple.Utils
import Distribution.Package
( PackageIdentifier, showPackageId, Package(..) )
( PackageIdentifier, Package(..) )
import Distribution.Simple.Program
( Program(..), ConfiguredProgram(..), ProgramConfiguration
, rawSystemProgram, rawSystemProgramConf
......@@ -340,7 +340,7 @@ build pkg_descr lbi verbosity = do
createDirectoryIfMissingVerbose verbosity True libTargetDir
-- TODO: do we need to put hs-boot files into place for mutually recurive modules?
let ghcArgs =
["-package-name", showPackageId pkgid ]
["-package-name", display pkgid ]
++ constructGHCCmdLine lbi libBi libTargetDir verbosity
++ (libModules pkg_descr)
ghcArgsProf = ghcArgs
......@@ -446,8 +446,8 @@ build pkg_descr lbi verbosity = do
"-dynamic",
"-o", sharedLibFilePath ]
++ ghcSharedObjArgs
++ ["-package-name", showPackageId pkgid ]
++ (concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ])
++ ["-package-name", display pkgid ]
++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ ["-l"++extraLib | extraLib <- extraLibs libBi]
++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi]
......@@ -590,7 +590,7 @@ ghcOptions lbi bi odir
++ [ "-odir", odir, "-hidir", odir ]
++ (if compilerVersion c >= Version [6,8] []
then ["-stubdir", odir] else [])
++ (concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ])
++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ (case withOptimization lbi of
NoOptimisation -> []
NormalOptimisation -> ["-O"]
......@@ -616,7 +616,7 @@ constructCcCmdLine lbi bi pref filename verbosity
ghcCcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
ghcCcOptions lbi bi odir
= ["-I" ++ dir | dir <- includeDirs bi]
++ concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ]
++ concat [ ["-package", display pkg] | pkg <- packageDeps lbi ]
++ ["-optc" ++ opt | opt <- ccOptions bi]
++ (case withOptimization lbi of
NoOptimisation -> []
......@@ -624,7 +624,7 @@ ghcCcOptions lbi bi odir
++ ["-odir", odir]
mkGHCiLibName :: PackageIdentifier -> String
mkGHCiLibName lib = "HS" ++ showPackageId lib <.> "o"
mkGHCiLibName lib = "HS" ++ display lib <.> "o"
-- -----------------------------------------------------------------------------
-- Building a Makefile
......@@ -641,7 +641,7 @@ makefile pkg_descr lbi flags = do
let Just lib = library pkg_descr
bi = libBuildInfo lib
packageIdStr = showPackageId (packageId pkg_descr)
packageIdStr = display (packageId pkg_descr)
(arProg, _) <- requireProgram verbosity arProgram AnyVersion
(withPrograms lbi)
(ldProg, _) <- requireProgram verbosity ldProgram AnyVersion
......@@ -667,7 +667,7 @@ makefile pkg_descr lbi flags = do
("GHCI_LIB", builddir </> mkGHCiLibName (packageId pkg_descr)),
("soext", dllExtension),
("LIB_LD_OPTS", unwords (["-package-name", packageIdStr]
++ concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ]
++ concat [ ["-package", display pkg] | pkg <- packageDeps lbi ]
++ ["-l"++libName | libName <- extraLibs bi]
++ ["-L"++libDir | libDir <- extraLibDirs bi])),
("AR", programPath arProg),
......
......@@ -46,7 +46,8 @@ module Distribution.Simple.Haddock (
) where
-- local
import Distribution.Package (PackageIdentifier, showPackageId, Package(..))
import Distribution.Package
( PackageIdentifier, Package(..) )
import Distribution.PackageDescription as PD
(PackageDescription(..), BuildInfo(..), hcOptions,
Library(..), hasLibs, withLib,
......@@ -79,7 +80,7 @@ import Distribution.Simple.Utils
, createDirectoryIfMissingVerbose, withTempFile
, findFileWithExtension, findFile, dotToSep )
import Distribution.Text
( simpleParse )
( display, simpleParse )
import Distribution.Verbosity
import Language.Haskell.Extension
......@@ -128,7 +129,7 @@ haddock pkg_descr lbi suffixes flags = do
setupMessage verbosity "Running Haddock for" (packageId pkg_descr)
let replaceLitExts = map ( (tmpDir </>) . (`replaceExtension` "hs") )
let showPkg = showPackageId (packageId pkg_descr)
let showPkg = display (packageId pkg_descr)
let outputFlag = if fromFlag (haddockHoogle flags)
then "--hoogle"
else "--html"
......@@ -292,7 +293,7 @@ haddockPackageFlags lbi htmlTemplate = do
let missing = [ pkgid | (pkgid, Nothing) <- interfaces ]
warning = "The documentation for the following packages are not "
++ "installed. No links will be generated to these packages: "
++ intercalate ", " (map showPackageId missing)
++ intercalate ", " (map display missing)
flags = [ "--read-interface="
++ (if null html then "" else html ++ ",") ++ interface
| (_, Just (interface, html)) <- interfaces ]
......@@ -317,7 +318,7 @@ haddockPackageFlags lbi htmlTemplate = do
ghcSimpleOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
ghcSimpleOptions lbi bi mockDir
= ["-hide-all-packages"]
++ (concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ])
++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ ["-i"]
++ hcOptions GHC bi
++ ["-i" ++ autogenModulesDir lbi]
......
......@@ -75,7 +75,7 @@ import System.FilePath (dropDrive)
#endif
import Distribution.Package
( PackageIdentifier, packageName, packageVersion, showPackageId )
( PackageIdentifier, packageName, packageVersion )
import Distribution.System
( OS(..), buildOS )
import Distribution.Compiler
......@@ -410,7 +410,7 @@ initialPathTemplateEnv pkgId compilerId =
map (\(v,s) -> (v, PathTemplate [Ordinary s]))
[(PkgNameVar, packageName pkgId)
,(PkgVerVar, display (packageVersion pkgId))
,(PkgIdVar, showPackageId pkgId)
,(PkgIdVar, display pkgId)
,(CompilerVar, showCompilerId compilerId)]
-- ---------------------------------------------------------------------------
......
......@@ -69,12 +69,14 @@ import Distribution.Simple.Program ( ConfiguredProgram(..), jhcProgram,
rawSystemProgram, rawSystemProgramStdoutConf )
import Distribution.Version ( VersionRange(AnyVersion) )
import Distribution.Package
( showPackageId, parsePackageId, Package(..) )
( Package(..) )
import Distribution.Simple.Utils
( createDirectoryIfMissingVerbose, copyFileVerbose
, die, info, intercalate )
import System.FilePath ( (</>) )
import Distribution.Verbosity
import Distribution.Text
( parse, display )
import Distribution.Compat.ReadP
( readP_to_S, many, skipSpaces )
......@@ -113,7 +115,7 @@ getInstalledPackages :: Verbosity -> PackageDB -> ProgramConfiguration
-> IO (PackageIndex InstalledPackageInfo)
getInstalledPackages verbosity _packagedb conf = do
str <- rawSystemProgramStdoutConf verbosity jhcProgram conf ["--list-libraries"]
case pCheck (readP_to_S (many (skipSpaces >> parsePackageId)) str) of
case pCheck (readP_to_S (many (skipSpaces >> parse)) str) of
[ps] -> return $ PackageIndex.fromList
[ emptyInstalledPackageInfo {
InstalledPackageInfo.package = p
......@@ -137,7 +139,7 @@ build pkg_descr lbi verbosity = do
let libBi = libBuildInfo lib
let args = constructJHCCmdLine lbi libBi (buildDir lbi) verbosity
rawSystemProgram verbosity jhcProg (["-c"] ++ args ++ libModules pkg_descr)
let pkgid = showPackageId (packageId pkg_descr)
let pkgid = display (packageId pkg_descr)
pfile = buildDir lbi </> "jhc-pkg.conf"
hlfile= buildDir lbi </> (pkgid ++ ".hl")
writeFile pfile $ jhcPkgConf pkg_descr
......@@ -158,21 +160,21 @@ constructJHCCmdLine lbi bi _odir verbosity =
++ ["-i", autogenModulesDir lbi]
++ concat [["-i", l] | l <- nub (hsSourceDirs bi)]
++ ["-optc" ++ opt | opt <- PD.ccOptions bi]
++ (concat [ ["-p", showPackageId pkg] | pkg <- packageDeps lbi ])
++ (concat [ ["-p", display pkg] | pkg <- packageDeps lbi ])
jhcPkgConf :: PackageDescription -> String
jhcPkgConf pd =
let sline name sel = name ++ ": "++sel pd
Just lib = library pd
comma = intercalate ","
in unlines [sline "name" (showPackageId . packageId)
in unlines [sline "name" (display . packageId)
,"exposed-modules: " ++ (comma (PD.exposedModules lib))
,"hidden-modules: " ++ (comma (otherModules $ libBuildInfo lib))
]
installLib :: Verbosity -> FilePath -> FilePath -> PackageDescription -> Library -> IO ()
installLib verb dest build_dir pkg_descr _ = do
let p = showPackageId (packageId pkg_descr)++".hl"
let p = display (packageId pkg_descr)++".hl"
createDirectoryIfMissingVerbose verb True dest
copyFileVerbose verb (build_dir </> p) (dest </> p)
......
......@@ -59,7 +59,8 @@ import Distribution.Simple.PreProcess.Unlit (unlit)
import Distribution.PackageDescription (PackageDescription(..),
BuildInfo(..), Executable(..), withExe,
Library(..), withLib, libModules)
import Distribution.Package (showPackageId, Package(..))
import Distribution.Package
( Package(..) )
import Distribution.Simple.Compiler
( CompilerFlavor(..), Compiler(..), compilerFlavor, compilerVersion )
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..))
......@@ -75,6 +76,8 @@ import Distribution.Simple.Program (Program(..), ConfiguredProgram(..),
haddockProgram, ghcProgram)
import Distribution.Version (Version(..))
import Distribution.Verbosity
import Distribution.Text
( display )
import Control.Monad (when, unless, join)
import Data.Maybe (fromMaybe)
......@@ -345,7 +348,7 @@ ppHsc2hs bi lbi = pp
++ cppOptions bi ]
++ [ "--cflag=" ++ opt | pkg <- packageDeps lbi
, opt <- ["-package"
,showPackageId pkg] ]
,display pkg] ]
++ [ "--cflag=-I" ++ dir | dir <- includeDirs bi]
++ [ "--lflag=-optl" ++ opt | opt <- getLdOptions bi ]
......
......@@ -63,7 +63,7 @@ import Distribution.Simple.Setup (RegisterFlags(..), CopyDest(..),
import Distribution.PackageDescription (PackageDescription(..),
BuildInfo(..), Library(..))
import Distribution.Package
( packageName, showPackageId, Package(..) )
( Package(..), packageName )
import Distribution.InstalledPackageInfo
(InstalledPackageInfo, showInstalledPackageInfo,
emptyInstalledPackageInfo)
......@@ -73,6 +73,8 @@ import Distribution.Simple.Utils
, die, info, notice, setupMessage )
import Distribution.System
( OS(..), buildOS )
import Distribution.Text
( display )
import System.FilePath ((</>), (<.>), isAbsolute)
import System.Directory (removeFile, getCurrentDirectory,
......@@ -109,7 +111,7 @@ register pkg_descr lbi regFlags
let isWindows = case buildOS of Windows -> True; _ -> False
genScript = fromFlag (regGenScript regFlags)
genPkgConf = isJust (fromFlag (regGenPkgConf regFlags))
genPkgConfigDefault = showPackageId (packageId pkg_descr) <.> "conf"
genPkgConfigDefault = display (packageId pkg_descr) <.> "conf"
genPkgConfigFile = fromMaybe genPkgConfigDefault
(fromFlag (regGenPkgConf regFlags))
verbosity = fromFlag (regVerbose regFlags)
......@@ -255,7 +257,7 @@ mkInstalledPackageInfo pkg_descr lbi inplace = do
IPI.hiddenModules = otherModules bi,
IPI.importDirs = [libraryDir],
IPI.libraryDirs = libraryDir : extraLibDirs bi,
IPI.hsLibraries = ["HS" ++ showPackageId (packageId pkg_descr)],
IPI.hsLibraries = ["HS" ++ display (packageId pkg_descr)],
IPI.extraLibraries = extraLibs bi,
IPI.includeDirs = absinc ++ if inplace