Skip to content

Commit 5e42df5

Browse files
committed
Apply Cabal-syntax changes to remaining modules
1 parent 29a9cc9 commit 5e42df5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+962
-627
lines changed

Cabal-QuickCheck/Cabal-QuickCheck.cabal

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ library
1313
build-depends:
1414
, base
1515
, bytestring
16-
, Cabal ^>=3.7.0.0
17-
, QuickCheck ^>=2.13.2 || ^>=2.14
16+
, Cabal ^>=3.7.0.0
17+
, Cabal-syntax ^>=3.7.0.0
18+
, QuickCheck ^>=2.13.2 || ^>=2.14
1819

1920
if !impl(ghc >= 8.0)
2021
build-depends: semigroups

Cabal-described/Cabal-described.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ library
1212
build-depends:
1313
, base
1414
, Cabal ^>=3.7.0.0
15+
, Cabal-syntax ^>=3.7.0.0
1516
, containers
1617
, pretty
1718
, QuickCheck

Cabal-syntax/Cabal-syntax.cabal

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,27 @@ library
7777
build-depends: tagged >=0.8.6 && <0.9, bytestring-builder >= 0.10.8 && <0.11
7878

7979
exposed-modules:
80+
Distribution.Backpack
81+
Distribution.BuildToolDepends
82+
Distribution.CCompiler
8083
Distribution.CabalSpecVersion
8184
Distribution.Compat.Binary
8285
Distribution.Compat.CharParsing
8386
Distribution.Compat.DList
8487
Distribution.Compat.Exception
88+
Distribution.Compat.Graph
8589
Distribution.Compat.Lens
8690
Distribution.Compat.MonadFail
8791
Distribution.Compat.Newtype
8892
Distribution.Compat.NonEmptySet
8993
Distribution.Compat.Parsing
90-
Distribution.Compat.Prelude
94+
Distribution.Compat.Prelude.Internal
9195
Distribution.Compat.Semigroup
9296
Distribution.Compat.Typeable
9397
Distribution.Compiler
9498
Distribution.FieldGrammar
9599
Distribution.FieldGrammar.Class
100+
Distribution.FieldGrammar.FieldDescrs
96101
Distribution.FieldGrammar.Newtypes
97102
Distribution.FieldGrammar.Parsec
98103
Distribution.FieldGrammar.Pretty
@@ -104,10 +109,12 @@ library
104109
Distribution.Fields.ParseResult
105110
Distribution.Fields.Parser
106111
Distribution.Fields.Pretty
112+
Distribution.InstalledPackageInfo
107113
Distribution.License
108114
Distribution.ModuleName
109115
Distribution.Package
110116
Distribution.PackageDescription
117+
Distribution.PackageDescription.Check
111118
Distribution.PackageDescription.Configuration
112119
Distribution.PackageDescription.FieldGrammar
113120
Distribution.PackageDescription.Parsec
@@ -128,6 +135,7 @@ library
128135
Distribution.SPDX.LicenseListVersion
129136
Distribution.SPDX.LicenseReference
130137
Distribution.System
138+
Distribution.Types.AbiDependency
131139
Distribution.Types.AbiHash
132140
Distribution.Types.Benchmark
133141
Distribution.Types.Benchmark.Lens
@@ -149,6 +157,7 @@ library
149157
Distribution.Types.Executable
150158
Distribution.Types.Executable.Lens
151159
Distribution.Types.ExecutableScope
160+
Distribution.Types.ExposedModule
152161
Distribution.Types.Flag
153162
Distribution.Types.ForeignLib
154163
Distribution.Types.ForeignLib.Lens
@@ -158,6 +167,9 @@ library
158167
Distribution.Types.GenericPackageDescription.Lens
159168
Distribution.Types.HookedBuildInfo
160169
Distribution.Types.IncludeRenaming
170+
Distribution.Types.InstalledPackageInfo
171+
Distribution.Types.InstalledPackageInfo.FieldGrammar
172+
Distribution.Types.InstalledPackageInfo.Lens
161173
Distribution.Types.LegacyExeDependency
162174
Distribution.Types.Lens
163175
Distribution.Types.Library
@@ -195,7 +207,9 @@ library
195207
Distribution.Types.VersionInterval
196208
Distribution.Types.VersionRange
197209
Distribution.Types.VersionRange.Internal
210+
Distribution.Utils.Base62
198211
Distribution.Utils.Generic
212+
Distribution.Utils.Glob
199213
Distribution.Utils.MD5
200214
Distribution.Utils.Path
201215
Distribution.Utils.ShortText
@@ -204,6 +218,9 @@ library
204218
Distribution.Version
205219
Language.Haskell.Extension
206220

221+
other-modules:
222+
Distribution.Compat.Prelude
223+
207224
other-extensions:
208225
BangPatterns
209226
CPP
File renamed without changes.

Cabal/src/Distribution/Simple/BuildToolDepends.hs renamed to Cabal-syntax/src/Distribution/BuildToolDepends.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-- This modules provides functions for working with both the legacy
44
-- "build-tools" field, and its replacement, "build-tool-depends". Prefer using
55
-- the functions contained to access those fields directly.
6-
module Distribution.Simple.BuildToolDepends where
6+
module Distribution.BuildToolDepends where
77

88
import Prelude ()
99
import Distribution.Compat.Prelude

Cabal/src/Distribution/Simple/CCompiler.hs renamed to Cabal-syntax/src/Distribution/CCompiler.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3939
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4040
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
4141

42-
module Distribution.Simple.CCompiler (
42+
module Distribution.CCompiler (
4343
CDialect(..),
4444
cSourceExtensions,
4545
cDialectFilenameExtension,
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE FlexibleContexts #-}
3+
{-# LANGUAGE RankNTypes #-}
4+
5+
module Distribution.Compat.CreatePipe (createPipe) where
6+
7+
#if MIN_VERSION_process(1,2,1)
8+
import System.Process (createPipe)
9+
#else
10+
import System.IO (Handle, hSetBinaryMode)
11+
12+
import Prelude ()
13+
import Distribution.Compat.Prelude
14+
import Distribution.Compat.Stack
15+
16+
-- The mingw32_HOST_OS CPP macro is GHC-specific
17+
#ifdef mingw32_HOST_OS
18+
import qualified Prelude
19+
import Control.Exception (onException)
20+
import Foreign.C.Error (throwErrnoIfMinus1_)
21+
import Foreign.C.Types (CInt(..), CUInt(..))
22+
import Foreign.Ptr (Ptr)
23+
import Foreign.Marshal.Array (allocaArray)
24+
import Foreign.Storable (peek, peekElemOff)
25+
import GHC.IO.FD (mkFD)
26+
import GHC.IO.Device (IODeviceType(Stream))
27+
import GHC.IO.Handle.FD (mkHandleFromFD)
28+
import System.IO (IOMode(ReadMode, WriteMode))
29+
#elif defined ghcjs_HOST_OS
30+
#else
31+
import System.Posix.IO (fdToHandle)
32+
import qualified System.Posix.IO as Posix
33+
#endif
34+
35+
createPipe :: IO (Handle, Handle)
36+
-- The mingw32_HOST_OS CPP macro is GHC-specific
37+
#ifdef mingw32_HOST_OS
38+
createPipe = do
39+
(readfd, writefd) <- allocaArray 2 $ \ pfds -> do
40+
throwErrnoIfMinus1_ "_pipe" $ c__pipe pfds 2 ({- _O_BINARY -} 32768)
41+
readfd <- peek pfds
42+
writefd <- peekElemOff pfds 1
43+
return (readfd, writefd)
44+
(do readh <- fdToHandle readfd ReadMode
45+
writeh <- fdToHandle writefd WriteMode
46+
hSetBinaryMode readh True
47+
hSetBinaryMode writeh True
48+
return (readh, writeh)) `onException` (close readfd >> close writefd)
49+
where
50+
fdToHandle :: CInt -> IOMode -> IO Handle
51+
fdToHandle fd mode = do
52+
(fd', deviceType) <- mkFD fd mode (Just (Stream, 0, 0)) False False
53+
mkHandleFromFD fd' deviceType "" mode False Nothing
54+
55+
close :: CInt -> IO ()
56+
close = throwErrnoIfMinus1_ "_close" . c__close
57+
where _ = callStack -- TODO: attach call stack to exception
58+
59+
_ = callStack -- TODO: attach call stack to exceptions
60+
61+
foreign import ccall "io.h _pipe" c__pipe ::
62+
Ptr CInt -> CUInt -> CInt -> Prelude.IO CInt
63+
64+
foreign import ccall "io.h _close" c__close ::
65+
CInt -> Prelude.IO CInt
66+
#elif defined ghcjs_HOST_OS
67+
createPipe = error "createPipe"
68+
where
69+
_ = callStack
70+
#else
71+
createPipe = do
72+
(readfd, writefd) <- Posix.createPipe
73+
readh <- fdToHandle readfd
74+
writeh <- fdToHandle writefd
75+
hSetBinaryMode readh True
76+
hSetBinaryMode writeh True
77+
return (readh, writeh)
78+
where
79+
_ = callStack
80+
#endif
81+
#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)