Skip to content

Commit

Permalink
Merge branch 'master' into top-level-guides-and-reference
Browse files Browse the repository at this point in the history
  • Loading branch information
malteneuss authored Nov 2, 2023
2 parents 2b5a8a9 + 1157461 commit 76f48d4
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 50 deletions.
3 changes: 2 additions & 1 deletion .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@
- ignore: {name: "Use when"} # 1 hint

- arguments:
- --ignore-glob=Cabal-syntax/src/Distribution/Fields/Lexer.hs
- --ignore-glob=cabal-testsuite/PackageTests/CmmSources/src/Demo.hs
- --ignore-glob=cabal-testsuite/PackageTests/CmmSourcesDyn/src/Demo.hs
- --ignore-glob=Cabal-syntax/src/Distribution/Fields/Lexer.hs
- --ignore-glob=cabal-testsuite/PackageTests/CmmSourcesExe/src/Demo.hs
- --ignore-glob=templates/Paths_pkg.template.hs
- --ignore-glob=templates/SPDX.LicenseExceptionId.template.hs
- --ignore-glob=templates/SPDX.LicenseId.template.hs
24 changes: 12 additions & 12 deletions Cabal-tests/Cabal-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ test-suite unit-tests
, Cabal-QuickCheck
, containers
, deepseq
, Diff >=0.4 && <0.5
, Diff >=0.4 && <0.6
, directory
, filepath
, integer-logarithms >=1.0.2 && <1.1
, pretty
, QuickCheck >=2.14 && <2.15
, rere >=0.1 && <0.3
, tagged
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-hunit
, tasty-quickcheck
, temporary
Expand All @@ -84,14 +84,14 @@ test-suite parser-tests
main-is: ParserTests.hs
build-depends:
base
, base-compat >=0.11.0 && <0.13
, base-compat >=0.11.0 && <0.14
, bytestring
, Cabal-syntax
, Cabal-tree-diff
, Diff >=0.4 && <0.5
, Diff >=0.4 && <0.6
, directory
, filepath
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-golden >=2.3.1.1 && <2.4
, tasty-hunit
, tasty-quickcheck
Expand All @@ -109,10 +109,10 @@ test-suite check-tests
, bytestring
, Cabal
, Cabal-syntax
, Diff >=0.4 && <0.5
, Diff >=0.4 && <0.6
, directory
, filepath
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-expected-failure
, tasty-golden >=2.3.1.1 && <2.4

Expand Down Expand Up @@ -155,10 +155,10 @@ test-suite hackage-tests
, filepath

build-depends:
base-compat >=0.11.0 && <0.13
, base-orphans >=0.6 && <0.9
base-compat >=0.11.0 && <0.14
, base-orphans >=0.6 && <0.10
, clock >=0.8 && <0.9
, optparse-applicative >=0.13.2.0 && <0.17
, optparse-applicative >=0.13.2.0 && <0.19
, stm >=2.4.5.0 && <2.6
, tar >=0.5.0.3 && <0.6
, tree-diff >=0.1 && <0.4
Expand All @@ -178,7 +178,7 @@ test-suite rpmvercmp

build-depends:
QuickCheck
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-hunit
, tasty-quickcheck

Expand All @@ -197,7 +197,7 @@ test-suite no-thunks-test
base
, bytestring
, Cabal-syntax
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-hunit

-- this is test is buildable on old GHCs
Expand Down
3 changes: 3 additions & 0 deletions Cabal/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 3.10.2.1 [Hécate](mailto:hecate+github@glitchbra.in) October 2023
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.2.1.md

# 3.10.2.0 [Hécate](mailto:hecate+github@glitchbra.in) August 2023
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.2.0.md

Expand Down
7 changes: 5 additions & 2 deletions Cabal/src/Distribution/Make.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ defaultMainArgs :: [String] -> IO ()
defaultMainArgs = defaultMainHelper

defaultMainHelper :: [String] -> IO ()
defaultMainHelper args =
case commandsRun (globalCommand commands) commands args of
defaultMainHelper args = do
command <- commandsRun (globalCommand commands) commands args
case command of
CommandDelegate -> pure ()
CommandHelp help -> printHelp help
CommandList opts -> printOptionsList opts
CommandErrors errs -> printErrors errs
Expand All @@ -98,6 +100,7 @@ defaultMainHelper args =
_
| fromFlag (globalVersion flags) -> printVersion
| fromFlag (globalNumericVersion flags) -> printNumericVersion
CommandDelegate -> pure ()
CommandHelp help -> printHelp help
CommandList opts -> printOptionsList opts
CommandErrors errs -> printErrors errs
Expand Down
5 changes: 4 additions & 1 deletion Cabal/src/Distribution/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ defaultMainWithHooksNoReadArgs hooks pkg_descr =
defaultMainHelper :: UserHooks -> Args -> IO ()
defaultMainHelper hooks args = topHandler $ do
args' <- expandResponse args
case commandsRun (globalCommand commands) commands args' of
command <- commandsRun (globalCommand commands) commands args'
case command of
CommandDelegate -> pure ()
CommandHelp help -> printHelp help
CommandList opts -> printOptionsList opts
CommandErrors errs -> printErrors errs
Expand All @@ -177,6 +179,7 @@ defaultMainHelper hooks args = topHandler $ do
_
| fromFlag (globalVersion flags) -> printVersion
| fromFlag (globalNumericVersion flags) -> printNumericVersion
CommandDelegate -> pure ()
CommandHelp help -> printHelp help
CommandList opts -> printOptionsList opts
CommandErrors errs -> printErrors errs
Expand Down
35 changes: 27 additions & 8 deletions Cabal/src/Distribution/Simple/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ module Distribution.Simple.Command
import Distribution.Compat.Prelude hiding (get)
import Prelude ()

import Control.Exception (try)
import qualified Data.Array as Array
import qualified Data.List as List
import Distribution.Compat.Lens (ALens', (#~), (^#))
import qualified Distribution.GetOpt as GetOpt
import Distribution.ReadE
import Distribution.Simple.Utils
import System.Directory (findExecutable)
import System.Process (callProcess)

data CommandUI flags = CommandUI
{ commandName :: String
Expand Down Expand Up @@ -596,11 +599,13 @@ data CommandParse flags
| CommandList [String]
| CommandErrors [String]
| CommandReadyToGo flags
| CommandDelegate
instance Functor CommandParse where
fmap _ (CommandHelp help) = CommandHelp help
fmap _ (CommandList opts) = CommandList opts
fmap _ (CommandErrors errs) = CommandErrors errs
fmap f (CommandReadyToGo flags) = CommandReadyToGo (f flags)
fmap _ CommandDelegate = CommandDelegate

data CommandType = NormalCommand | HiddenCommand
data Command action
Expand Down Expand Up @@ -631,25 +636,38 @@ commandsRun
:: CommandUI a
-> [Command action]
-> [String]
-> CommandParse (a, CommandParse action)
-> IO (CommandParse (a, CommandParse action))
commandsRun globalCommand commands args =
case commandParseArgs globalCommand True args of
CommandHelp help -> CommandHelp help
CommandList opts -> CommandList (opts ++ commandNames)
CommandErrors errs -> CommandErrors errs
CommandDelegate -> pure CommandDelegate
CommandHelp help -> pure $ CommandHelp help
CommandList opts -> pure $ CommandList (opts ++ commandNames)
CommandErrors errs -> pure $ CommandErrors errs
CommandReadyToGo (mkflags, args') -> case args' of
("help" : cmdArgs) -> handleHelpCommand cmdArgs
("help" : cmdArgs) -> pure $ handleHelpCommand cmdArgs
(name : cmdArgs) -> case lookupCommand name of
[Command _ _ action _] ->
CommandReadyToGo (flags, action cmdArgs)
_ -> CommandReadyToGo (flags, badCommand name)
[] -> CommandReadyToGo (flags, noCommand)
pure $ CommandReadyToGo (flags, action cmdArgs)
_ -> do
mCommand <- findExecutable $ "cabal-" <> name
case mCommand of
Just exec -> callExternal flags exec cmdArgs
Nothing -> pure $ CommandReadyToGo (flags, badCommand name)
[] -> pure $ CommandReadyToGo (flags, noCommand)
where
flags = mkflags (commandDefaultFlags globalCommand)
where
lookupCommand cname =
[ cmd | cmd@(Command cname' _ _ _) <- commands', cname' == cname
]

callExternal :: a -> String -> [String] -> IO (CommandParse (a, CommandParse action))
callExternal flags exec cmdArgs = do
result <- try $ callProcess exec cmdArgs
case result of
Left ex -> pure $ CommandErrors ["Error executing external command: " ++ show (ex :: SomeException)]
Right _ -> pure $ CommandReadyToGo (flags, CommandDelegate)

noCommand = CommandErrors ["no command given (try --help)\n"]

-- Print suggested command if edit distance is < 5
Expand Down Expand Up @@ -679,6 +697,7 @@ commandsRun globalCommand commands args =
-- furthermore, support "prog help command" as "prog command --help"
handleHelpCommand cmdArgs =
case commandParseArgs helpCommandUI True cmdArgs of
CommandDelegate -> CommandDelegate
CommandHelp help -> CommandHelp help
CommandList list -> CommandList (list ++ commandNames)
CommandErrors _ -> CommandHelp globalHelp
Expand Down
2 changes: 1 addition & 1 deletion cabal-benchmarks/cabal-benchmarks.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ test-suite cabal-benchmarks
base
, bytestring
, Cabal-syntax
, criterion >=1.5.6.2 && <1.6
, criterion >=1.5.6.2 && <1.7
6 changes: 3 additions & 3 deletions cabal-install-solver/cabal-install-solver.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ library

build-depends:
, array >=0.4 && <0.6
, base >=4.10 && <4.19
, base >=4.10 && <4.20
, bytestring >=0.10.6.0 && <0.13
, Cabal ^>=3.11
, Cabal-syntax ^>=3.11
Expand Down Expand Up @@ -138,10 +138,10 @@ Test-Suite unit-tests
UnitTests.Distribution.Solver.Modular.MessageUtils

build-depends:
, base >= 4.10 && <4.19
, base >= 4.10 && <4.20
, Cabal
, Cabal-syntax
, cabal-install-solver
, tasty >= 1.2.3 && <1.5
, tasty >= 1.2.3 && <1.6
, tasty-quickcheck
, tasty-hunit >= 0.10
6 changes: 3 additions & 3 deletions cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ common warnings
ghc-options: -Wunused-packages

common base-dep
build-depends: base >=4.10 && <4.19
build-depends: base >=4.10 && <4.20

common cabal-dep
build-depends: Cabal ^>=3.11
Expand Down Expand Up @@ -229,7 +229,7 @@ library
time >= 1.5.0.1 && < 1.13,
zlib >= 0.5.3 && < 0.7,
hackage-security >= 0.6.2.0 && < 0.7,
text >= 1.2.3 && < 1.3 || >= 2.0 && < 2.1,
text >= 1.2.3 && < 1.3 || >= 2.0 && < 2.2,
parsec >= 3.1.13.0 && < 3.2,
regex-base >= 0.94.0.0 && <0.95,
regex-posix >= 0.96.0.0 && <0.97,
Expand Down Expand Up @@ -332,7 +332,7 @@ test-suite unit-tests
tar,
time,
zlib,
tasty >= 1.2.3 && <1.5,
tasty >= 1.2.3 && <1.6,
tasty-golden >=2.3.1.1 && <2.4,
tasty-quickcheck,
tasty-hunit >= 0.10,
Expand Down
7 changes: 5 additions & 2 deletions cabal-install/src/Distribution/Client/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,10 @@ warnIfAssertionsAreEnabled =
-- into IO actions for execution.
mainWorker :: [String] -> IO ()
mainWorker args = do
topHandler $
case commandsRun (globalCommand commands) commands args of
topHandler $ do
command <- commandsRun (globalCommand commands) commands args
case command of
CommandDelegate -> pure ()
CommandHelp help -> printGlobalHelp help
CommandList opts -> printOptionsList opts
CommandErrors errs -> printErrors errs
Expand All @@ -334,6 +336,7 @@ mainWorker args = do
printVersion
| fromFlagOrDefault False (globalNumericVersion globalFlags) ->
printNumericVersion
CommandDelegate -> pure ()
CommandHelp help -> printCommandHelp help
CommandList opts -> printOptionsList opts
CommandErrors errs -> do
Expand Down
6 changes: 3 additions & 3 deletions cabal-install/src/Distribution/Client/ProjectBuilding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,9 @@ rebuildTargets
info verbosity $
"Executing install plan "
++ case buildSettingNumJobs of
NumJobs n -> " in parallel using " ++ show n ++ " threads."
UseSem n -> " in parallel using a semaphore with " ++ show n ++ " slots."
Serial -> " serially."
NumJobs n -> "in parallel using " ++ show n ++ " threads."
UseSem n -> "in parallel using a semaphore with " ++ show n ++ " slots."
Serial -> "serially."

createDirectoryIfMissingVerbose verbosity True distBuildRootDirectory
createDirectoryIfMissingVerbose verbosity True distTempDirectory
Expand Down
1 change: 1 addition & 0 deletions cabal-install/src/Distribution/Client/SavedFlags.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ readCommandFlags :: FilePath -> CommandUI flags -> IO flags
readCommandFlags path command = do
savedArgs <- fmap (fromMaybe []) (readSavedArgs path)
case (commandParseArgs command True savedArgs) of
CommandDelegate -> error "CommandDelegate Flags evaluated, this should never occur"
CommandHelp _ -> throwIO (SavedArgsErrorHelp savedArgs)
CommandList _ -> throwIO (SavedArgsErrorList savedArgs)
CommandErrors errs -> throwIO (SavedArgsErrorOther savedArgs errs)
Expand Down
8 changes: 4 additions & 4 deletions cabal-testsuite/cabal-testsuite.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ common shared
default-language: Haskell2010

build-depends:
, base >= 4.9 && <4.19
, base >= 4.9 && <4.20
-- this needs to match the in-tree lib:Cabal version
, Cabal ^>= 3.11.0.0
, Cabal-syntax ^>= 3.11.0.0
Expand Down Expand Up @@ -57,7 +57,7 @@ library
Test.Cabal.ScriptEnv0

build-depends:
, aeson ^>= 1.4.2.0 || ^>=1.5.0.0 || ^>= 2.0.0.0 || ^>= 2.1.0.0
, aeson ^>= 1.4.2.0 || ^>=1.5.0.0 || ^>= 2.0.0.0 || ^>= 2.1.0.0 || ^>= 2.2.1.0
, async ^>= 2.2.1
, attoparsec ^>= 0.13.2.2 || ^>=0.14.1
, base64-bytestring ^>= 1.0.0.0 || ^>= 1.1.0.0 || ^>= 1.2.0.0
Expand All @@ -68,14 +68,14 @@ library
, exceptions ^>= 0.10.0
, filepath ^>= 1.3.0.1 || ^>= 1.4.0.0
, network-wait ^>= 0.1.2.0 || ^>= 0.2.0.0
, optparse-applicative ^>= 0.14.3.0 || ^>=0.15.1.0 || ^>=0.16.0.0 || ^>= 0.17.0.0
, optparse-applicative ^>= 0.14.3.0 || ^>=0.15.1.0 || ^>=0.16.0.0 || ^>= 0.17.0.0 || ^>= 0.18.1.0
, process ^>= 1.2.1.0 || ^>= 1.4.2.0 || ^>= 1.6.1.0
, regex-base ^>= 0.94.0.1
, regex-tdfa ^>= 1.2.3.1 || ^>=1.3.1.0
, retry ^>= 0.9.1.0
, array ^>= 0.4.0.1 || ^>= 0.5.0.0
, temporary ^>= 1.3
, text ^>= 1.2.3.1 || ^>= 2.0.1
, text ^>= 1.2.3.1 || ^>= 2.0.1 || ^>= 2.1
, transformers ^>= 0.3.0.0 || ^>= 0.4.2.0 || ^>= 0.5.2.0 || ^>= 0.6.0.2

if !os(windows)
Expand Down
8 changes: 0 additions & 8 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,9 @@ packages: cabal-benchmarks/

optional-packages: ./vendored/*/*.cabal

allow-newer:
hackage-security:Cabal

-- avoiding extra dependencies
constraints: rere -rere-cfg
constraints: these -assoc

-- Andreas, 2022-08-19, https://github.com/haskell/cabal/issues/8377
-- Force latest dependencies in the development version:
constraints: text >= 2.0
constraints: time >= 1.12

program-options
ghc-options: -fno-ignore-asserts
6 changes: 6 additions & 0 deletions changelog.d/pr-9376
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
synopsis: Avoid a double space in "Executing install plan ..."
description:
The "Executing·install·plan··serially" and other similar "Executing install
plan··..." outputs no longer contain double spaces.
packages: cabal-install
prs: #9376
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
# Output file base name for HTML help builder.
htmlhelp_basename = 'CabalUsersGuide'

# MathJax to use SVG rendering by default
mathjax_path = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_SVG'
# MathJax to use HTML rendering by default (makes the text selectable, see #8453)
mathjax_path = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_CHTML'


# -- Options for LaTeX output ---------------------------------------------
Expand Down
Loading

0 comments on commit 76f48d4

Please sign in to comment.