packages feed

cabal2nix 1.19 → 1.20

raw patch · 3 files changed

+14/−4 lines, 3 files

Files

cabal2nix.cabal view
@@ -1,5 +1,5 @@ Name:                   cabal2nix-Version:                1.19+Version:                1.20 Copyright:              Peter Simons, Andres Loeh License:                BSD3 License-File:           LICENSE
src/Cabal2Nix/Generate.hs view
@@ -48,7 +48,7 @@                         (configureCabalFlags pkg)                         (const True)                         (Platform I386 Linux)                   -- shouldn't be hardcoded-                        (CompilerId GHC (Version [7,0,4] []))   -- dito+                        (CompilerId GHC (Version [7,2,2] []))   -- dito                         [] cabal  unDep :: Cabal.Dependency -> String
src/Cabal2Nix/Hackage.hs view
@@ -5,7 +5,8 @@ import Data.Version ( showVersion ) import Distribution.Package ( PackageIdentifier(..), PackageName(..) ) import Distribution.Text-import Network.HTTP ( simpleHTTP, getRequest, getResponseBody )+import Network.HTTP ( getRequest, rspBody )+import Network.Browser ( browse, request, setCheckForProxy, setDebugLog, setOutHandler ) import System.Directory ( doesFileExist, getHomeDirectory, createDirectoryIfMissing ) import System.FilePath ( dropFileName, (</>), (<.>) ) import System.Process ( readProcess )@@ -48,6 +49,15 @@ readCabalFile :: FilePath -> IO String readCabalFile path   | "cabal://" `isPrefixOf` path = let Just pid = simpleParse (drop 8 path) in readCabalFile (hackagePath pid Cabal)-  | "http://"  `isPrefixOf` path = simpleHTTP (getRequest path) >>= getResponseBody+  | "http://"  `isPrefixOf` path = fetchUrl path   | "file://"  `isPrefixOf` path = readCabalFile (drop 7 path)   | otherwise                    = readFile path++fetchUrl :: String -> IO String+fetchUrl url = do+  (_,rsp) <- Network.Browser.browse $ do+     setCheckForProxy True+     setDebugLog Nothing+     setOutHandler (\_ -> return ())+     request (getRequest url)+  return (rspBody rsp)