Skip to content

Commit 9886c2e

Browse files
committed
Remove Internal SetupMethod
This SetupMethod is no longer used; it is replaced by the InLibrary SetupMethod which directly calls Cabal library functions instead of going through defaultMain.
1 parent 2dde9fa commit 9886c2e

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

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

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import Distribution.Compiler
5151
( CompilerFlavor (GHC, GHCJS)
5252
, buildCompilerId
5353
)
54-
import qualified Distribution.Make as Make
5554
import Distribution.Package
5655
( ComponentId
5756
, PackageId
@@ -69,7 +68,6 @@ import Distribution.PackageDescription
6968
, buildType
7069
, specVersion
7170
)
72-
import qualified Distribution.Simple as Simple
7371
import Distribution.Simple.Build.Macros
7472
( generatePackageVersionMacros
7573
)
@@ -129,9 +127,6 @@ import Distribution.Client.Utils
129127
( existsAndIsMoreRecentThan
130128
, moreRecentFile
131129
, tryCanonicalizePath
132-
, withEnv
133-
, withEnvOverrides
134-
, withExtraPathEnv
135130
)
136131
#ifdef mingw32_HOST_OS
137132
import Distribution.Client.Utils
@@ -291,8 +286,6 @@ data ASetup = forall kind. ASetup ( Setup kind )
291286

292287
-- | @SetupMethod@ represents one of the methods used to run Cabal commands.
293288
data SetupMethod (kind :: SetupKind) where
294-
-- | run Cabal commands through @cabal@ in the current process
295-
InternalMethod :: SetupMethod GeneralSetup
296289
-- | Directly use Cabal library functions, bypassing the Setup
297290
-- mechanism entirely.
298291
LibraryMethod :: SetupMethod InLibrary
@@ -517,7 +510,6 @@ withSetupMethod verbosity options pkg buildType' allowInLibrary with
517510
with <$> getExternalSetupMethod verbosity options pkg buildType'
518511

519512
runSetupMethod :: WithCallStack (SetupMethod GeneralSetup -> SetupRunner UseGeneralSetup)
520-
runSetupMethod InternalMethod = internalSetupMethod
521513
runSetupMethod (ExternalMethod path) = externalSetupMethod path
522514
runSetupMethod SelfExecMethod = selfExecSetupMethod
523515

@@ -702,46 +694,15 @@ setupWrapper verbosity options mpkg cmd getCommonFlags getFlags getExtraArgs wra
702694
SRegisterPhase -> InLibrary.register flags lbi extraArgs
703695
NotInLibrary ->
704696
error "internal error: NotInLibrary argument but getSetup chose InLibrary"
705-
InternalMethod -> notInLibraryMethod
706697
ExternalMethod {} -> notInLibraryMethod
707698
SelfExecMethod -> notInLibraryMethod
708699

709700
-- ------------------------------------------------------------
710701

711-
-- * Internal SetupMethod
702+
-- * 'invoke' function
712703

713704
-- ------------------------------------------------------------
714705

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-
745706
invoke :: Verbosity -> FilePath -> [String] -> SetupScriptOptions -> IO ()
746707
invoke verbosity path args options = do
747708
info verbosity $ unwords (path : args)

0 commit comments

Comments
 (0)