@@ -51,7 +51,6 @@ import Distribution.Compiler
51
51
( CompilerFlavor (GHC , GHCJS )
52
52
, buildCompilerId
53
53
)
54
- import qualified Distribution.Make as Make
55
54
import Distribution.Package
56
55
( ComponentId
57
56
, PackageId
@@ -69,7 +68,6 @@ import Distribution.PackageDescription
69
68
, buildType
70
69
, specVersion
71
70
)
72
- import qualified Distribution.Simple as Simple
73
71
import Distribution.Simple.Build.Macros
74
72
( generatePackageVersionMacros
75
73
)
@@ -129,9 +127,6 @@ import Distribution.Client.Utils
129
127
( existsAndIsMoreRecentThan
130
128
, moreRecentFile
131
129
, tryCanonicalizePath
132
- , withEnv
133
- , withEnvOverrides
134
- , withExtraPathEnv
135
130
)
136
131
#ifdef mingw32_HOST_OS
137
132
import Distribution.Client.Utils
@@ -291,8 +286,6 @@ data ASetup = forall kind. ASetup ( Setup kind )
291
286
292
287
-- | @SetupMethod@ represents one of the methods used to run Cabal commands.
293
288
data SetupMethod (kind :: SetupKind ) where
294
- -- | run Cabal commands through @cabal@ in the current process
295
- InternalMethod :: SetupMethod GeneralSetup
296
289
-- | Directly use Cabal library functions, bypassing the Setup
297
290
-- mechanism entirely.
298
291
LibraryMethod :: SetupMethod InLibrary
@@ -517,7 +510,6 @@ withSetupMethod verbosity options pkg buildType' allowInLibrary with
517
510
with <$> getExternalSetupMethod verbosity options pkg buildType'
518
511
519
512
runSetupMethod :: WithCallStack (SetupMethod GeneralSetup -> SetupRunner UseGeneralSetup )
520
- runSetupMethod InternalMethod = internalSetupMethod
521
513
runSetupMethod (ExternalMethod path) = externalSetupMethod path
522
514
runSetupMethod SelfExecMethod = selfExecSetupMethod
523
515
@@ -702,46 +694,15 @@ setupWrapper verbosity options mpkg cmd getCommonFlags getFlags getExtraArgs wra
702
694
SRegisterPhase -> InLibrary. register flags lbi extraArgs
703
695
NotInLibrary ->
704
696
error " internal error: NotInLibrary argument but getSetup chose InLibrary"
705
- InternalMethod -> notInLibraryMethod
706
697
ExternalMethod {} -> notInLibraryMethod
707
698
SelfExecMethod -> notInLibraryMethod
708
699
709
700
-- ------------------------------------------------------------
710
701
711
- -- * Internal SetupMethod
702
+ -- * 'invoke' function
712
703
713
704
-- ------------------------------------------------------------
714
705
715
- -- | Run a Setup script by directly invoking the @Cabal@ library.
716
- internalSetupMethod :: SetupRunner UseGeneralSetup
717
- internalSetupMethod verbosity options bt args NotInLibrary = do
718
- info verbosity $
719
- " Using internal setup method with build-type "
720
- ++ show bt
721
- ++ " and args:\n "
722
- ++ show args
723
- -- NB: we do not set the working directory of the process here, because
724
- -- we will instead pass the -working-dir flag when invoking the Setup script.
725
- -- Note that the Setup script is guaranteed to support this flag, because
726
- -- the logic in 'withSetupMethod' guarantees we have an up-to-date Cabal version.
727
- --
728
- -- In the future, it would be desirable to also stop relying on the following
729
- -- pieces of process-global state, as this would allow us to use this internal
730
- -- setup method in concurrent contexts.
731
- withEnv " HASKELL_DIST_DIR" (getSymbolicPath $ useDistPref options) $
732
- withExtraPathEnv (useExtraPathEnv options) $
733
- withEnvOverrides (useExtraEnvOverrides options) $
734
- buildTypeAction bt args
735
-
736
- buildTypeAction :: BuildType -> ([String ] -> IO () )
737
- buildTypeAction Simple = Simple. defaultMainArgs
738
- buildTypeAction Configure =
739
- Simple. defaultMainWithSetupHooksArgs
740
- Simple. autoconfSetupHooks
741
- buildTypeAction Make = Make. defaultMainArgs
742
- buildTypeAction Hooks = error " buildTypeAction Hooks"
743
- buildTypeAction Custom = error " buildTypeAction Custom"
744
-
745
706
invoke :: Verbosity -> FilePath -> [String ] -> SetupScriptOptions -> IO ()
746
707
invoke verbosity path args options = do
747
708
info verbosity $ unwords (path : args)
0 commit comments