Skip to content

Commit 76f48d4

Browse files
authored
Merge branch 'master' into top-level-guides-and-reference
2 parents 2b5a8a9 + 1157461 commit 76f48d4

File tree

19 files changed

+99
-50
lines changed

19 files changed

+99
-50
lines changed

.hlint.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@
9494
- ignore: {name: "Use when"} # 1 hint
9595

9696
- arguments:
97+
- --ignore-glob=Cabal-syntax/src/Distribution/Fields/Lexer.hs
9798
- --ignore-glob=cabal-testsuite/PackageTests/CmmSources/src/Demo.hs
9899
- --ignore-glob=cabal-testsuite/PackageTests/CmmSourcesDyn/src/Demo.hs
99-
- --ignore-glob=Cabal-syntax/src/Distribution/Fields/Lexer.hs
100+
- --ignore-glob=cabal-testsuite/PackageTests/CmmSourcesExe/src/Demo.hs
100101
- --ignore-glob=templates/Paths_pkg.template.hs
101102
- --ignore-glob=templates/SPDX.LicenseExceptionId.template.hs
102103
- --ignore-glob=templates/SPDX.LicenseId.template.hs

Cabal-tests/Cabal-tests.cabal

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ test-suite unit-tests
6060
, Cabal-QuickCheck
6161
, containers
6262
, deepseq
63-
, Diff >=0.4 && <0.5
63+
, Diff >=0.4 && <0.6
6464
, directory
6565
, filepath
6666
, integer-logarithms >=1.0.2 && <1.1
6767
, pretty
6868
, QuickCheck >=2.14 && <2.15
6969
, rere >=0.1 && <0.3
7070
, tagged
71-
, tasty >=1.2.3 && <1.5
71+
, tasty >=1.2.3 && <1.6
7272
, tasty-hunit
7373
, tasty-quickcheck
7474
, temporary
@@ -84,14 +84,14 @@ test-suite parser-tests
8484
main-is: ParserTests.hs
8585
build-depends:
8686
base
87-
, base-compat >=0.11.0 && <0.13
87+
, base-compat >=0.11.0 && <0.14
8888
, bytestring
8989
, Cabal-syntax
9090
, Cabal-tree-diff
91-
, Diff >=0.4 && <0.5
91+
, Diff >=0.4 && <0.6
9292
, directory
9393
, filepath
94-
, tasty >=1.2.3 && <1.5
94+
, tasty >=1.2.3 && <1.6
9595
, tasty-golden >=2.3.1.1 && <2.4
9696
, tasty-hunit
9797
, tasty-quickcheck
@@ -109,10 +109,10 @@ test-suite check-tests
109109
, bytestring
110110
, Cabal
111111
, Cabal-syntax
112-
, Diff >=0.4 && <0.5
112+
, Diff >=0.4 && <0.6
113113
, directory
114114
, filepath
115-
, tasty >=1.2.3 && <1.5
115+
, tasty >=1.2.3 && <1.6
116116
, tasty-expected-failure
117117
, tasty-golden >=2.3.1.1 && <2.4
118118

@@ -155,10 +155,10 @@ test-suite hackage-tests
155155
, filepath
156156

157157
build-depends:
158-
base-compat >=0.11.0 && <0.13
159-
, base-orphans >=0.6 && <0.9
158+
base-compat >=0.11.0 && <0.14
159+
, base-orphans >=0.6 && <0.10
160160
, clock >=0.8 && <0.9
161-
, optparse-applicative >=0.13.2.0 && <0.17
161+
, optparse-applicative >=0.13.2.0 && <0.19
162162
, stm >=2.4.5.0 && <2.6
163163
, tar >=0.5.0.3 && <0.6
164164
, tree-diff >=0.1 && <0.4
@@ -178,7 +178,7 @@ test-suite rpmvercmp
178178

179179
build-depends:
180180
QuickCheck
181-
, tasty >=1.2.3 && <1.5
181+
, tasty >=1.2.3 && <1.6
182182
, tasty-hunit
183183
, tasty-quickcheck
184184

@@ -197,7 +197,7 @@ test-suite no-thunks-test
197197
base
198198
, bytestring
199199
, Cabal-syntax
200-
, tasty >=1.2.3 && <1.5
200+
, tasty >=1.2.3 && <1.6
201201
, tasty-hunit
202202

203203
-- this is test is buildable on old GHCs

Cabal/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 3.10.2.1 [Hécate](mailto:[email protected]) October 2023
2+
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.2.1.md
3+
14
# 3.10.2.0 [Hécate](mailto:[email protected]) August 2023
25
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.2.0.md
36

Cabal/src/Distribution/Make.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ defaultMainArgs :: [String] -> IO ()
8888
defaultMainArgs = defaultMainHelper
8989

9090
defaultMainHelper :: [String] -> IO ()
91-
defaultMainHelper args =
92-
case commandsRun (globalCommand commands) commands args of
91+
defaultMainHelper args = do
92+
command <- commandsRun (globalCommand commands) commands args
93+
case command of
94+
CommandDelegate -> pure ()
9395
CommandHelp help -> printHelp help
9496
CommandList opts -> printOptionsList opts
9597
CommandErrors errs -> printErrors errs
@@ -98,6 +100,7 @@ defaultMainHelper args =
98100
_
99101
| fromFlag (globalVersion flags) -> printVersion
100102
| fromFlag (globalNumericVersion flags) -> printNumericVersion
103+
CommandDelegate -> pure ()
101104
CommandHelp help -> printHelp help
102105
CommandList opts -> printOptionsList opts
103106
CommandErrors errs -> printErrors errs

Cabal/src/Distribution/Simple.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ defaultMainWithHooksNoReadArgs hooks pkg_descr =
168168
defaultMainHelper :: UserHooks -> Args -> IO ()
169169
defaultMainHelper hooks args = topHandler $ do
170170
args' <- expandResponse args
171-
case commandsRun (globalCommand commands) commands args' of
171+
command <- commandsRun (globalCommand commands) commands args'
172+
case command of
173+
CommandDelegate -> pure ()
172174
CommandHelp help -> printHelp help
173175
CommandList opts -> printOptionsList opts
174176
CommandErrors errs -> printErrors errs
@@ -177,6 +179,7 @@ defaultMainHelper hooks args = topHandler $ do
177179
_
178180
| fromFlag (globalVersion flags) -> printVersion
179181
| fromFlag (globalNumericVersion flags) -> printNumericVersion
182+
CommandDelegate -> pure ()
180183
CommandHelp help -> printHelp help
181184
CommandList opts -> printOptionsList opts
182185
CommandErrors errs -> printErrors errs

Cabal/src/Distribution/Simple/Command.hs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,15 @@ module Distribution.Simple.Command
8585
import Distribution.Compat.Prelude hiding (get)
8686
import Prelude ()
8787

88+
import Control.Exception (try)
8889
import qualified Data.Array as Array
8990
import qualified Data.List as List
9091
import Distribution.Compat.Lens (ALens', (#~), (^#))
9192
import qualified Distribution.GetOpt as GetOpt
9293
import Distribution.ReadE
9394
import Distribution.Simple.Utils
95+
import System.Directory (findExecutable)
96+
import System.Process (callProcess)
9497

9598
data CommandUI flags = CommandUI
9699
{ commandName :: String
@@ -596,11 +599,13 @@ data CommandParse flags
596599
| CommandList [String]
597600
| CommandErrors [String]
598601
| CommandReadyToGo flags
602+
| CommandDelegate
599603
instance Functor CommandParse where
600604
fmap _ (CommandHelp help) = CommandHelp help
601605
fmap _ (CommandList opts) = CommandList opts
602606
fmap _ (CommandErrors errs) = CommandErrors errs
603607
fmap f (CommandReadyToGo flags) = CommandReadyToGo (f flags)
608+
fmap _ CommandDelegate = CommandDelegate
604609

605610
data CommandType = NormalCommand | HiddenCommand
606611
data Command action
@@ -631,25 +636,38 @@ commandsRun
631636
:: CommandUI a
632637
-> [Command action]
633638
-> [String]
634-
-> CommandParse (a, CommandParse action)
639+
-> IO (CommandParse (a, CommandParse action))
635640
commandsRun globalCommand commands args =
636641
case commandParseArgs globalCommand True args of
637-
CommandHelp help -> CommandHelp help
638-
CommandList opts -> CommandList (opts ++ commandNames)
639-
CommandErrors errs -> CommandErrors errs
642+
CommandDelegate -> pure CommandDelegate
643+
CommandHelp help -> pure $ CommandHelp help
644+
CommandList opts -> pure $ CommandList (opts ++ commandNames)
645+
CommandErrors errs -> pure $ CommandErrors errs
640646
CommandReadyToGo (mkflags, args') -> case args' of
641-
("help" : cmdArgs) -> handleHelpCommand cmdArgs
647+
("help" : cmdArgs) -> pure $ handleHelpCommand cmdArgs
642648
(name : cmdArgs) -> case lookupCommand name of
643649
[Command _ _ action _] ->
644-
CommandReadyToGo (flags, action cmdArgs)
645-
_ -> CommandReadyToGo (flags, badCommand name)
646-
[] -> CommandReadyToGo (flags, noCommand)
650+
pure $ CommandReadyToGo (flags, action cmdArgs)
651+
_ -> do
652+
mCommand <- findExecutable $ "cabal-" <> name
653+
case mCommand of
654+
Just exec -> callExternal flags exec cmdArgs
655+
Nothing -> pure $ CommandReadyToGo (flags, badCommand name)
656+
[] -> pure $ CommandReadyToGo (flags, noCommand)
647657
where
648658
flags = mkflags (commandDefaultFlags globalCommand)
649659
where
650660
lookupCommand cname =
651661
[ cmd | cmd@(Command cname' _ _ _) <- commands', cname' == cname
652662
]
663+
664+
callExternal :: a -> String -> [String] -> IO (CommandParse (a, CommandParse action))
665+
callExternal flags exec cmdArgs = do
666+
result <- try $ callProcess exec cmdArgs
667+
case result of
668+
Left ex -> pure $ CommandErrors ["Error executing external command: " ++ show (ex :: SomeException)]
669+
Right _ -> pure $ CommandReadyToGo (flags, CommandDelegate)
670+
653671
noCommand = CommandErrors ["no command given (try --help)\n"]
654672

655673
-- Print suggested command if edit distance is < 5
@@ -679,6 +697,7 @@ commandsRun globalCommand commands args =
679697
-- furthermore, support "prog help command" as "prog command --help"
680698
handleHelpCommand cmdArgs =
681699
case commandParseArgs helpCommandUI True cmdArgs of
700+
CommandDelegate -> CommandDelegate
682701
CommandHelp help -> CommandHelp help
683702
CommandList list -> CommandList (list ++ commandNames)
684703
CommandErrors _ -> CommandHelp globalHelp

cabal-benchmarks/cabal-benchmarks.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ test-suite cabal-benchmarks
3131
base
3232
, bytestring
3333
, Cabal-syntax
34-
, criterion >=1.5.6.2 && <1.6
34+
, criterion >=1.5.6.2 && <1.7

cabal-install-solver/cabal-install-solver.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ library
105105

106106
build-depends:
107107
, array >=0.4 && <0.6
108-
, base >=4.10 && <4.19
108+
, base >=4.10 && <4.20
109109
, bytestring >=0.10.6.0 && <0.13
110110
, Cabal ^>=3.11
111111
, Cabal-syntax ^>=3.11
@@ -138,10 +138,10 @@ Test-Suite unit-tests
138138
UnitTests.Distribution.Solver.Modular.MessageUtils
139139

140140
build-depends:
141-
, base >= 4.10 && <4.19
141+
, base >= 4.10 && <4.20
142142
, Cabal
143143
, Cabal-syntax
144144
, cabal-install-solver
145-
, tasty >= 1.2.3 && <1.5
145+
, tasty >= 1.2.3 && <1.6
146146
, tasty-quickcheck
147147
, tasty-hunit >= 0.10

cabal-install/cabal-install.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ common warnings
4646
ghc-options: -Wunused-packages
4747

4848
common base-dep
49-
build-depends: base >=4.10 && <4.19
49+
build-depends: base >=4.10 && <4.20
5050

5151
common cabal-dep
5252
build-depends: Cabal ^>=3.11
@@ -229,7 +229,7 @@ library
229229
time >= 1.5.0.1 && < 1.13,
230230
zlib >= 0.5.3 && < 0.7,
231231
hackage-security >= 0.6.2.0 && < 0.7,
232-
text >= 1.2.3 && < 1.3 || >= 2.0 && < 2.1,
232+
text >= 1.2.3 && < 1.3 || >= 2.0 && < 2.2,
233233
parsec >= 3.1.13.0 && < 3.2,
234234
regex-base >= 0.94.0.0 && <0.95,
235235
regex-posix >= 0.96.0.0 && <0.97,
@@ -332,7 +332,7 @@ test-suite unit-tests
332332
tar,
333333
time,
334334
zlib,
335-
tasty >= 1.2.3 && <1.5,
335+
tasty >= 1.2.3 && <1.6,
336336
tasty-golden >=2.3.1.1 && <2.4,
337337
tasty-quickcheck,
338338
tasty-hunit >= 0.10,

cabal-install/src/Distribution/Client/Main.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,10 @@ warnIfAssertionsAreEnabled =
322322
-- into IO actions for execution.
323323
mainWorker :: [String] -> IO ()
324324
mainWorker args = do
325-
topHandler $
326-
case commandsRun (globalCommand commands) commands args of
325+
topHandler $ do
326+
command <- commandsRun (globalCommand commands) commands args
327+
case command of
328+
CommandDelegate -> pure ()
327329
CommandHelp help -> printGlobalHelp help
328330
CommandList opts -> printOptionsList opts
329331
CommandErrors errs -> printErrors errs
@@ -334,6 +336,7 @@ mainWorker args = do
334336
printVersion
335337
| fromFlagOrDefault False (globalNumericVersion globalFlags) ->
336338
printNumericVersion
339+
CommandDelegate -> pure ()
337340
CommandHelp help -> printCommandHelp help
338341
CommandList opts -> printOptionsList opts
339342
CommandErrors errs -> do

0 commit comments

Comments
 (0)