From aca3c9fc6358cb2ebdcd2669c1262fca42b223bb Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Fri, 7 Aug 2015 09:58:15 +0200 Subject: Work around `require-sandbox: True` --- CabalHelper/Wrapper.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'CabalHelper/Wrapper.hs') diff --git a/CabalHelper/Wrapper.hs b/CabalHelper/Wrapper.hs index b827de6..ef20a2e 100644 --- a/CabalHelper/Wrapper.hs +++ b/CabalHelper/Wrapper.hs @@ -373,6 +373,7 @@ installCabal opts ver = do \Building Cabal %s ...\n" appdir sver sver sver db <- createPkgDb opts ver + cabalInstallVer <- cabalInstallVersion opts cabal_opts <- return $ concat [ [ "--package-db=clear" @@ -381,6 +382,9 @@ installCabal opts ver = do , "--prefix=" ++ db "prefix" , "--with-ghc=" ++ ghcProgram opts ] + , if cabalInstallVer >= Version [1,20,0,0] [] + then ["--no-require-sandbox"] + else [] , if ghcPkgProgram opts /= ghcPkgProgram defaultOptions then [ "--with-ghc-pkg=" ++ ghcPkgProgram opts ] else [] @@ -402,6 +406,10 @@ ghcPkgVersion :: Options -> IO Version ghcPkgVersion Options {..} = do parseVer . trim . dropWhile (not . isDigit) <$> readProcess ghcPkgProgram ["--version"] "" +cabalInstallVersion :: Options -> IO Version +cabalInstallVersion Options {..} = do + parseVer . trim <$> readProcess cabalProgram ["--numeric-version"] "" + trim :: String -> String trim = dropWhileEnd isSpace -- cgit v1.2.3