Skip to content

Commit 5f0ee41

Browse files
committed
Bump ansi-terminal dependency to ansi-terminal-1.0
1 parent dcec87d commit 5f0ee41

File tree

10 files changed

+63
-70
lines changed

10 files changed

+63
-70
lines changed

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dependencies:
5858
- Cabal >= 3.8.1.0
5959
- aeson >= 2.0.3.0
6060
- annotated-wl-pprint
61-
- ansi-terminal
61+
- ansi-terminal >= 1.0
6262
- array
6363
- async
6464
- attoparsec

src/Stack/Config.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ import Stack.Types.Version
138138
( IntersectingVersionRange (..), VersionCheck (..)
139139
, stackVersion, withinRange
140140
)
141-
import System.Console.ANSI
142-
( hSupportsANSIWithoutEmulation, setSGRCode )
141+
import System.Console.ANSI ( hSupportsANSI, setSGRCode )
143142
import System.Environment ( getEnvironment, lookupEnv )
144143
import System.Info.ShortPathName ( getShortPathName )
145144
import System.PosixCompat.Files ( fileOwner, getFileStatus )
@@ -428,8 +427,7 @@ configFromConfigMonoid
428427
Just True -> pure True
429428
_ -> getInContainer
430429
configRunner' <- view runnerL
431-
useAnsi <- liftIO $ fromMaybe True <$>
432-
hSupportsANSIWithoutEmulation stderr
430+
useAnsi <- liftIO $ hSupportsANSI stderr
433431
let stylesUpdate' = (configRunner' ^. stylesUpdateL) <>
434432
configMonoidStyles
435433
useColor' = runnerUseColor configRunner'

src/Stack/DefaultColorWhen.hs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1+
{-# LANGUAGE LambdaCase #-}
2+
13
module Stack.DefaultColorWhen
24
( defaultColorWhen
35
) where
46

57
import Stack.Prelude ( stdout )
68
import Stack.Types.ColorWhen ( ColorWhen (..) )
7-
import System.Console.ANSI ( hSupportsANSIWithoutEmulation )
9+
import System.Console.ANSI ( hSupportsANSI )
810
import System.Environment ( lookupEnv )
911

1012
-- | The default adopts the standard proposed at http://no-color.org/, that
1113
-- color should not be added by default if the @NO_COLOR@ environment variable
1214
-- is present.
1315
defaultColorWhen :: IO ColorWhen
14-
defaultColorWhen = do
15-
-- On Windows, 'hSupportsANSIWithoutEmulation' has the side effect of enabling
16-
-- ANSI for ANSI-capable native (ConHost) terminals, if not already
17-
-- ANSI-enabled. Consequently, it is actioned even if @NO_COLOR@ might exist,
18-
-- as @NO_COLOR@ might be overridden in a yaml configuration file or at the
19-
-- command line.
20-
supportsANSI <- hSupportsANSIWithoutEmulation stdout
21-
mIsNoColor <- lookupEnv "NO_COLOR"
22-
pure $ case mIsNoColor of
23-
Just _ -> ColorNever
24-
_ -> case supportsANSI of
25-
Just False -> ColorNever
26-
_ -> ColorAuto
16+
defaultColorWhen = lookupEnv "NO_COLOR" >>= \case
17+
Just _ -> pure ColorNever
18+
_ -> hSupportsANSI stdout >>= \case
19+
False -> pure ColorNever
20+
_ -> pure ColorAuto

src/Stack/Runners.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import Stack.Types.Runner
4747
import Stack.Types.StackYamlLoc ( StackYamlLoc (..) )
4848
import Stack.Types.Version
4949
( minorVersion, stackMinorVersion, stackVersion )
50-
import System.Console.ANSI ( hSupportsANSIWithoutEmulation )
50+
import System.Console.ANSI ( hSupportsANSI )
5151
import System.Terminal ( getTerminalWidth )
5252

5353
-- | Type representing exceptions thrown by functions exported by the
@@ -175,8 +175,7 @@ withRunnerGlobal go inner = do
175175
useColor <- case colorWhen of
176176
ColorNever -> pure False
177177
ColorAlways -> pure True
178-
ColorAuto -> fromMaybe True <$>
179-
hSupportsANSIWithoutEmulation stderr
178+
ColorAuto -> hSupportsANSI stderr
180179
termWidth <- clipWidth <$> maybe (fromMaybe defaultTerminalWidth
181180
<$> getTerminalWidth)
182181
pure (globalTermWidth go)

src/Stack/Upgrade.hs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import Path ( (</>), parseRelDir )
1515
import RIO.Process ( proc, runProcess_, withWorkingDir )
1616
import Stack.Build ( build )
1717
import Stack.Build.Target ( NeedTargets (..) )
18-
import Stack.Constants
19-
( osIsWindows, relDirStackProgName, stackDotYaml )
18+
import Stack.Constants ( relDirStackProgName, stackDotYaml )
2019
import Stack.Internal.BuildInfo ( maybeGitHash )
2120
import Stack.Prelude hiding ( force, Display (..) )
2221
import Stack.Runners
@@ -34,7 +33,6 @@ import Stack.Types.Config ( Config (..), HasConfig (..), buildOptsL )
3433
import Stack.Types.GlobalOpts ( GlobalOpts (..) )
3534
import Stack.Types.Runner ( Runner, globalOptsL )
3635
import Stack.Types.StackYamlLoc ( StackYamlLoc (..) )
37-
import System.Console.ANSI ( hSupportsANSIWithoutEmulation )
3836
import System.Process ( rawSystem, readProcess )
3937

4038
-- | Type representing \'pretty\' exceptions thrown by functions in the
@@ -246,12 +244,6 @@ sourceUpgrade builtHash (SourceOpts gitRepo) =
246244
, branch
247245
]
248246
withWorkingDir (toFilePath tmp) $ proc "git" args runProcess_
249-
-- On Windows 10, an upstream issue with the `git clone` command
250-
-- means that command clears, but does not then restore, the
251-
-- ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for native terminals.
252-
-- The following hack re-enables the lost ANSI-capability.
253-
when osIsWindows $
254-
void $ liftIO $ hSupportsANSIWithoutEmulation stdout
255247
pure $ Just $ tmp </> relDirStackProgName
256248
-- We need to access the Pantry database to find out about the latest
257249
-- Stack available on Hackage. We first use a standard Config to do this,

stack-ghc-9.4.5.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
# built with GHC 9.4.5.
33

44
# GHC 9.4.5
5-
resolver: nightly-2023-05-03
5+
resolver: nightly-2023-05-13
66

77
packages:
88
- .
99

1010
extra-deps:
11-
- hi-file-parser-0.1.4.0@sha256:4c3e1f4e2575809c7fe47229f8547c64e22760d77c73456bf017d27e0e736dd8,2660
12-
- pantry-0.8.2.2@sha256:579aa8538c0fde65f9c08fb97d1d5aee8f59e5cc44e5f8feb350ec54bd2b14a6,6026
11+
- ansi-terminal-1.0@sha256:640ffecfd95471388d939fcacb57bdc0cef15f0457746c234a12cdd5a6c6d1e8,2706
12+
13+
allow-newer: true
14+
15+
allow-newer-deps:
16+
# Required because ansi-wl-pprint-0.6.9 specifies ansi-terminal < 0.12. See:
17+
# https://github.com/ekmett/ansi-wl-pprint/issues/29
18+
- ansi-wl-pprint
1319

1420
drop-packages:
1521
# See https://github.com/commercialhaskell/stack/pull/4712
@@ -26,8 +32,6 @@ nix:
2632
- unzip
2733

2834
flags:
29-
ansi-terminal:
30-
win32-2-13-1: false
3135
hackage-security:
3236
cabal-syntax: true
3337
mintty:

stack-ghc-9.4.5.yaml.lock

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,15 @@
55

66
packages:
77
- completed:
8-
hackage: hi-file-parser-0.1.4.0@sha256:4c3e1f4e2575809c7fe47229f8547c64e22760d77c73456bf017d27e0e736dd8,2660
8+
hackage: ansi-terminal-1.0@sha256:640ffecfd95471388d939fcacb57bdc0cef15f0457746c234a12cdd5a6c6d1e8,2706
99
pantry-tree:
10-
sha256: 39ac287c76db4428ba1f78de6d93441d5900609755049557f46c0508a65dcbe3
11-
size: 2242
10+
sha256: d2028688664a01877fcbf4a7dc820574bec07f17393e570a98c00c49cd28d5cf
11+
size: 1061
1212
original:
13-
hackage: hi-file-parser-0.1.4.0@sha256:4c3e1f4e2575809c7fe47229f8547c64e22760d77c73456bf017d27e0e736dd8,2660
14-
- completed:
15-
hackage: pantry-0.8.2.2@sha256:579aa8538c0fde65f9c08fb97d1d5aee8f59e5cc44e5f8feb350ec54bd2b14a6,6026
16-
pantry-tree:
17-
sha256: f979dadd233a05272bfee435de5d66532692532453d199adb902079a75cb878d
18-
size: 2970
19-
original:
20-
hackage: pantry-0.8.2.2@sha256:579aa8538c0fde65f9c08fb97d1d5aee8f59e5cc44e5f8feb350ec54bd2b14a6,6026
13+
hackage: ansi-terminal-1.0@sha256:640ffecfd95471388d939fcacb57bdc0cef15f0457746c234a12cdd5a6c6d1e8,2706
2114
snapshots:
2215
- completed:
23-
sha256: 5eb95e9f352b5cc0f192b5039ee2f19c88bddf53928b29a2efc54bc1697ab1ea
24-
size: 625217
25-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2023/5/3.yaml
26-
original: nightly-2023-05-03
16+
sha256: a638975b3da9a4182e4b4f0866c5fb01825dc04d74b503cb8e402f38c861368d
17+
size: 629111
18+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2023/5/13.yaml
19+
original: nightly-2023-05-13

stack.cabal

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ library
324324
Cabal >=3.8.1.0
325325
, aeson >=2.0.3.0
326326
, annotated-wl-pprint
327-
, ansi-terminal
327+
, ansi-terminal >=1.0
328328
, array
329329
, async
330330
, attoparsec
@@ -456,7 +456,7 @@ executable stack
456456
Cabal >=3.8.1.0
457457
, aeson >=2.0.3.0
458458
, annotated-wl-pprint
459-
, ansi-terminal
459+
, ansi-terminal >=1.0
460460
, array
461461
, async
462462
, attoparsec
@@ -581,7 +581,7 @@ executable stack-integration-test
581581
Cabal >=3.8.1.0
582582
, aeson >=2.0.3.0
583583
, annotated-wl-pprint
584-
, ansi-terminal
584+
, ansi-terminal >=1.0
585585
, array
586586
, async
587587
, attoparsec
@@ -713,7 +713,7 @@ test-suite stack-test
713713
, QuickCheck
714714
, aeson >=2.0.3.0
715715
, annotated-wl-pprint
716-
, ansi-terminal
716+
, ansi-terminal >=1.0
717717
, array
718718
, async
719719
, attoparsec

stack.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# GHC 9.2.7
2-
resolver: lts-20.19
2+
resolver: lts-20.20
33

44
packages:
55
- .
66

77
extra-deps:
8+
- ansi-terminal-1.0@sha256:640ffecfd95471388d939fcacb57bdc0cef15f0457746c234a12cdd5a6c6d1e8,2706
9+
- ansi-terminal-types-0.11.5@sha256:f78440dfd95c4509e88855ac7cc2d9566ddf956a92c1290404cac93ad1a1b00a,1482
810
- fsnotify-0.4.1.0@sha256:44540beabea36aeeef930aa4d5f28091d431904bc9923b6ac4d358831c651235,2854
9-
- hi-file-parser-0.1.4.0@sha256:4c3e1f4e2575809c7fe47229f8547c64e22760d77c73456bf017d27e0e736dd8,2660
1011
- pantry-0.8.2.2@sha256:579aa8538c0fde65f9c08fb97d1d5aee8f59e5cc44e5f8feb350ec54bd2b14a6,6026
1112
- persistent-2.14.5.0@sha256:c3c7a6a200930f956b2a6bb15b9d2cd512980692f6a2d95368a6db335c34c916,7199
1213
- rio-prettyprint-0.1.4.0@sha256:1f8eb3ead0ef33d3736d53e1de5e9b2c91a0c207cdca23321bd74c401e85f23a,1301
@@ -15,6 +16,13 @@ extra-deps:
1516
# lts-20.19 specifies Cabal-syntax-3.6.0.0
1617
- Cabal-syntax-3.8.1.0@sha256:4936765e9a7a8ecbf8fdbe9067f6d972bc0299220063abb2632a9950af64b966,7619
1718

19+
allow-newer: true
20+
21+
allow-newer-deps:
22+
# Required because ansi-wl-pprint-0.6.9 specifies ansi-terminal < 0.12. See:
23+
# https://github.com/ekmett/ansi-wl-pprint/issues/29
24+
- ansi-wl-pprint
25+
1826
drop-packages:
1927
# See https://github.com/commercialhaskell/stack/pull/4712
2028
- cabal-install
@@ -30,8 +38,6 @@ nix:
3038
- unzip
3139

3240
flags:
33-
ansi-terminal:
34-
win32-2-13-1: false
3541
hackage-security:
3642
Cabal-syntax: true
3743
mintty:

stack.yaml.lock

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,27 @@
44
# https://docs.haskellstack.org/en/stable/lock_files
55

66
packages:
7+
- completed:
8+
hackage: ansi-terminal-1.0@sha256:640ffecfd95471388d939fcacb57bdc0cef15f0457746c234a12cdd5a6c6d1e8,2706
9+
pantry-tree:
10+
sha256: d2028688664a01877fcbf4a7dc820574bec07f17393e570a98c00c49cd28d5cf
11+
size: 1061
12+
original:
13+
hackage: ansi-terminal-1.0@sha256:640ffecfd95471388d939fcacb57bdc0cef15f0457746c234a12cdd5a6c6d1e8,2706
14+
- completed:
15+
hackage: ansi-terminal-types-0.11.5@sha256:f78440dfd95c4509e88855ac7cc2d9566ddf956a92c1290404cac93ad1a1b00a,1482
16+
pantry-tree:
17+
sha256: 0a03e697837c4fae43543f3be0fcf9d88157ba637fbd1b656fc8bf79b1656a14
18+
size: 291
19+
original:
20+
hackage: ansi-terminal-types-0.11.5@sha256:f78440dfd95c4509e88855ac7cc2d9566ddf956a92c1290404cac93ad1a1b00a,1482
721
- completed:
822
hackage: fsnotify-0.4.1.0@sha256:44540beabea36aeeef930aa4d5f28091d431904bc9923b6ac4d358831c651235,2854
923
pantry-tree:
1024
sha256: f8e89e81fe0ca6e285036e04b165119ccfc59e7e668c1bfc28927f39062c5949
1125
size: 1280
1226
original:
1327
hackage: fsnotify-0.4.1.0@sha256:44540beabea36aeeef930aa4d5f28091d431904bc9923b6ac4d358831c651235,2854
14-
- completed:
15-
hackage: hi-file-parser-0.1.4.0@sha256:4c3e1f4e2575809c7fe47229f8547c64e22760d77c73456bf017d27e0e736dd8,2660
16-
pantry-tree:
17-
sha256: 39ac287c76db4428ba1f78de6d93441d5900609755049557f46c0508a65dcbe3
18-
size: 2242
19-
original:
20-
hackage: hi-file-parser-0.1.4.0@sha256:4c3e1f4e2575809c7fe47229f8547c64e22760d77c73456bf017d27e0e736dd8,2660
2128
- completed:
2229
hackage: pantry-0.8.2.2@sha256:579aa8538c0fde65f9c08fb97d1d5aee8f59e5cc44e5f8feb350ec54bd2b14a6,6026
2330
pantry-tree:
@@ -55,7 +62,7 @@ packages:
5562
hackage: Cabal-syntax-3.8.1.0@sha256:4936765e9a7a8ecbf8fdbe9067f6d972bc0299220063abb2632a9950af64b966,7619
5663
snapshots:
5764
- completed:
58-
sha256: 42f77c84b34f68c30c2cd0bf8c349f617a0f428264362426290847a6a2019b64
59-
size: 649618
60-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/19.yaml
61-
original: lts-20.19
65+
sha256: 126fa33ceb11f5e85ceb4e86d434756bd9a8439e2e5776d306a15fbc63b01e89
66+
size: 650041
67+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/20.yaml
68+
original: lts-20.20

0 commit comments

Comments
 (0)