Skip to content

Commit

Permalink
Merge pull request #2941 from Heather/dep
Browse files Browse the repository at this point in the history
cabal-install: minor random improvements
  • Loading branch information
23Skidoo committed Dec 1, 2015
2 parents 96a8f7b + 215e688 commit 74e9383
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions cabal-install/Distribution/Client/Dependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ dontUpgradeNonUpgradeablePackages params =
[ LabeledPackageConstraint
(PackageConstraintInstalled pkgname)
ConstraintSourceNonUpgradeablePackage
| all (/=PackageName "base") (depResolverTargets params)
| notElem (PackageName "base") (depResolverTargets params)
, pkgname <- map PackageName [ "base", "ghc-prim", "integer-gmp"
, "integer-simple" ]
, isInstalled pkgname ]
Expand Down Expand Up @@ -601,8 +601,8 @@ interpretPackagesPreference selected defaultPref prefs =
[ (pkgname, pref)
| PackageInstalledPreference pkgname pref <- prefs ]
installPrefDefault = case defaultPref of
PreferAllLatest -> \_ -> PreferLatest
PreferAllInstalled -> \_ -> PreferInstalled
PreferAllLatest -> const PreferLatest
PreferAllInstalled -> const PreferInstalled
PreferLatestForSelected -> \pkgname ->
-- When you say cabal install foo, what you really mean is, prefer the
-- latest version of foo, but the installed version of everything else
Expand Down Expand Up @@ -637,7 +637,7 @@ validateSolverResult platform comp indepGoals pkgs =
formatPkgProblems = formatProblemMessage . map showPlanPackageProblem
formatPlanProblems = formatProblemMessage . map InstallPlan.showPlanProblem

formatProblemMessage problems =
formatProblemMessage problems =
unlines $
"internal error: could not construct a valid install plan."
: "The proposed (invalid) plan contained the following problems:"
Expand Down
5 changes: 2 additions & 3 deletions cabal-install/Distribution/Client/Haddock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module Distribution.Client.Haddock
where

import Data.List (maximumBy)
import Data.Foldable (forM_)
import System.Directory (createDirectoryIfMissing, renameFile)
import System.FilePath ((</>), splitFileName)
import Distribution.Package
Expand All @@ -40,9 +41,7 @@ regenerateHaddockIndex :: Verbosity
regenerateHaddockIndex verbosity pkgs conf index = do
(paths, warns) <- haddockPackagePaths pkgs' Nothing
let paths' = [ (interface, html) | (interface, Just html) <- paths]
case warns of
Nothing -> return ()
Just m -> debug verbosity m
forM_ warns (debug verbosity)

(confHaddock, _, _) <-
requireProgramVersion verbosity haddockProgram
Expand Down
10 changes: 5 additions & 5 deletions cabal-install/Distribution/Client/Manpage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ manpage pname commands = unlines $
] ++
concatMap (commandSynopsisLines pname) commands ++
[ ".SH DESCRIPTION"
, "Cabal is the standard package system for Haskell software. It helps people to configure, "
, "Cabal is the standard package system for Haskell software. It helps people to configure, "
, "build and install Haskell software and to distribute it easily to other users and developers."
, ""
, "The command line " ++ pname ++ " tool (also referred to as cabal-install) helps with "
Expand Down Expand Up @@ -84,7 +84,7 @@ commandSynopsisLines _ (CommandSpec _ _ HiddenCommand) = []

commandDetailsLines :: String -> CommandSpec action -> [String]
commandDetailsLines pname (CommandSpec ui _ NormalCommand) =
[ ".B " ++ pname ++ " " ++ (commandName ui)
[ ".B " ++ pname ++ " " ++ (commandName ui)
, ""
, commandUsage ui pname
, ""
Expand All @@ -96,7 +96,7 @@ commandDetailsLines pname (CommandSpec ui _ NormalCommand) =
] ++
optionsLines ui ++
[ ".RE"
, ""
, ""
]
where
optional field =
Expand All @@ -109,10 +109,10 @@ optionsLines :: CommandUI flags -> [String]
optionsLines command = concatMap optionLines (concatMap optionDescr (commandOptions command ParseArgs))

data ArgumentRequired = Optional | Required
type OptionArg = (ArgumentRequired, ArgPlaceHolder)
type OptionArg = (ArgumentRequired, ArgPlaceHolder)

optionLines :: OptDescr flags -> [String]
optionLines (ReqArg description (optionChars, optionStrings) placeHolder _ _) =
optionLines (ReqArg description (optionChars, optionStrings) placeHolder _ _) =
argOptionLines description optionChars optionStrings (Required, placeHolder)
optionLines (OptArg description (optionChars, optionStrings) placeHolder _ _ _) =
argOptionLines description optionChars optionStrings (Optional, placeHolder)
Expand Down
7 changes: 3 additions & 4 deletions cabal-install/Distribution/Client/SrcDist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@ import Distribution.Verbosity (Verbosity)
import Distribution.Version (Version(..), orLaterVersion)

import System.FilePath ((</>), (<.>))
import Control.Monad (when, unless)
import Control.Monad (when, unless, liftM)
import System.Directory (doesFileExist, removeFile, canonicalizePath)
import System.Process (runProcess, waitForProcess)
import System.Exit (ExitCode(..))

-- |Create a source distribution.
sdist :: SDistFlags -> SDistExFlags -> IO ()
sdist flags exflags = do
pkg <- return . flattenPackageDescription
=<< readPackageDescription verbosity
=<< defaultPackageDesc verbosity
pkg <- liftM flattenPackageDescription
(readPackageDescription verbosity =<< defaultPackageDesc verbosity)
let withDir = if not needMakeArchive then (\f -> f tmpTargetDir)
else withTempDirectory verbosity tmpTargetDir "sdist."
-- 'withTempDir' fails if we don't create 'tmpTargetDir'...
Expand Down

0 comments on commit 74e9383

Please sign in to comment.