mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-02-17 16:55:51 +01:00
no-user-package-conf vs no-user-package-db
This commit is contained in:
parent
3aa40eb35f
commit
6605fed064
@ -5,10 +5,20 @@ import System.Process
|
|||||||
import Distribution.Text (simpleParse)
|
import Distribution.Text (simpleParse)
|
||||||
import Data.Char (isSpace)
|
import Data.Char (isSpace)
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
|
import Data.Maybe (fromMaybe)
|
||||||
|
import Control.Monad (guard)
|
||||||
|
|
||||||
getGlobalPackages :: IO (Set PackageIdentifier)
|
getGlobalPackages :: IO (Set PackageIdentifier)
|
||||||
getGlobalPackages = do
|
getGlobalPackages = do
|
||||||
output <- readProcess "ghc-pkg" ["--no-user-package-db", "list"] ""
|
-- Account for a change in command line option name
|
||||||
|
versionOutput <- readProcess "ghc-pkg" ["--version"] ""
|
||||||
|
let arg = fromMaybe "--no-user-package-db" $ do
|
||||||
|
verS:_ <- Just $ reverse $ words versionOutput
|
||||||
|
v76 <- simpleParse "7.6"
|
||||||
|
ver <- simpleParse verS
|
||||||
|
guard $ ver < (v76 :: Version)
|
||||||
|
return "--no-user-package-conf"
|
||||||
|
output <- readProcess "ghc-pkg" [arg, "list"] ""
|
||||||
fmap Set.unions $ mapM parse $ drop 1 $ lines output
|
fmap Set.unions $ mapM parse $ drop 1 $ lines output
|
||||||
where
|
where
|
||||||
parse s =
|
parse s =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user