diff --git a/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs b/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs index 157d0fa09a4..edbc037fc6a 100644 --- a/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs +++ b/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs @@ -47,7 +47,7 @@ import Distribution.Client.Setup , filterHaddockFlags , filterTestFlags ) -import Distribution.Client.SetupWrapper +import Distribution.Client.SetupWrapper (SetupScriptOptions (..), setupWrapperNew) import Distribution.Client.SourceFiles import Distribution.Client.SrcDist (allPackageSourceFiles) import qualified Distribution.Client.Tar as Tar @@ -342,7 +342,7 @@ buildAndRegisterUnpackedPackage -> IO () setup cmd flags args = withLogging $ \mLogFileHandle -> - setupWrapper + setupWrapperNew verbosity scriptOptions { useLoggingHandle = mLogFileHandle @@ -362,7 +362,7 @@ buildAndRegisterUnpackedPackage -> (Version -> [String]) -> IO () setupInteractive cmd flags args = - setupWrapper + setupWrapperNew verbosity scriptOptions{isInteractive = True} (Just (elabPkgDescription pkg)) diff --git a/cabal-install/src/Distribution/Client/SetupWrapper.hs b/cabal-install/src/Distribution/Client/SetupWrapper.hs index eba9b833d9d..8359c8938b3 100644 --- a/cabal-install/src/Distribution/Client/SetupWrapper.hs +++ b/cabal-install/src/Distribution/Client/SetupWrapper.hs @@ -26,6 +26,7 @@ module Distribution.Client.SetupWrapper , setupWrapper , SetupScriptOptions (..) , defaultSetupScriptOptions + , setupWrapperNew ) where import Distribution.Client.Compat.Prelude @@ -505,6 +506,26 @@ setupWrapper verbosity options mpkg cmd flags extraArgs = do (flags $ setupVersion setup) (extraArgs $ setupVersion setup) +-- | Configure a 'Setup' and run a command in one step. The command flags +-- may depend on the Cabal library version in use. +setupWrapperNew + :: Verbosity + -> SetupScriptOptions + -> Maybe PackageDescription + -> CommandUI flags + -> (Version -> flags) + -- ^ produce command flags given the Cabal library version + -> (Version -> [String]) + -> IO () +setupWrapperNew verbosity options mpkg cmd flags extraArgs = do + setup <- getSetup verbosity options mpkg + runSetupCommand + verbosity + setup + cmd + (flags $ setupVersion setup) + (extraArgs $ setupVersion setup) + -- ------------------------------------------------------------ -- * Internal SetupMethod