on master help sign in
no-user-package-conf vs no-user-package-db
commit6605fed064becc6a1b7ba73c9ec05cb72862127d authorMichael Snoyman <michael@snoyman.com> dateWed 29 May 2013, 17:45 (13 years ago) parent3aa40eb
1 file changed+11−1
Stackage/GhcPkg.hs+11−1
Stackage/GhcPkg.hs+11−1
@@ -5,10 +5,20 @@ import System.Process
55import Distribution.Text (simpleParse)
66import Data.Char (isSpace)
77import qualified Data.Set as Set
8+import Data.Maybe (fromMaybe)
9+import Control.Monad (guard)
810
911getGlobalPackages :: IO (Set PackageIdentifier)
1012getGlobalPackages = do
11− output <- readProcess "ghc-pkg" ["--no-user-package-db", "list"] ""
13+ -- Account for a change in command line option name
14+ versionOutput <- readProcess "ghc-pkg" ["--version"] ""
15+ let arg = fromMaybe "--no-user-package-db" $ do
16+ verS:_ <- Just $ reverse $ words versionOutput
17+ v76 <- simpleParse "7.6"
18+ ver <- simpleParse verS
19+ guard $ ver < (v76 :: Version)
20+ return "--no-user-package-conf"
21+ output <- readProcess "ghc-pkg" [arg, "list"] ""
1222 fmap Set.unions $ mapM parse $ drop 1 $ lines output
1323 where
1424 parse s =