More for GHC 6.10
This commit is contained in:
parent
9d431c68a3
commit
a0391e5cd3
@ -1,5 +1,5 @@
|
||||
name: plugins
|
||||
version: 1.3.1
|
||||
version: 1.4.0
|
||||
homepage: http://code.haskell.org/~dons/code/hs-plugins
|
||||
synopsis: Dynamic linking for Haskell and C objects
|
||||
description: Dynamic linking and runtime evaluation of Haskell,
|
||||
@ -12,7 +12,7 @@ license: BSD3
|
||||
License-file: LICENSE
|
||||
author: Don Stewart 2004-2008
|
||||
maintainer: Don Stewart <dons@galois.com>
|
||||
cabal-version: >= 1.2
|
||||
cabal-version: >= 1.6
|
||||
build-type: Configure
|
||||
extra-source-files: config.guess, config.h.in, config.mk.in, config.sub,
|
||||
configure, configure.ac, install.sh, Makefile,
|
||||
@ -33,7 +33,6 @@ library
|
||||
System.Plugins.Make,
|
||||
System.Plugins.Package,
|
||||
System.Plugins.PackageAPI,
|
||||
System.Plugins.ParsePkgConfCabal,
|
||||
System.Plugins.Parser,
|
||||
System.Plugins.Process,
|
||||
System.Plugins.Utils
|
||||
|
@ -52,11 +52,11 @@ module System.Plugins.Env (
|
||||
|
||||
import System.Plugins.LoadTypes (Module)
|
||||
import System.Plugins.PackageAPI {- everything -}
|
||||
import System.Plugins.Consts ( ghcLibraryPath, sysPkgConf, sysPkgSuffix )
|
||||
import System.Plugins.Consts ( sysPkgConf, sysPkgSuffix )
|
||||
|
||||
import Data.IORef ( writeIORef, readIORef, newIORef, IORef() )
|
||||
import Data.Maybe ( isJust, isNothing, fromMaybe )
|
||||
import Data.List ( isPrefixOf, isInfixOf, nub )
|
||||
import Data.List ( isInfixOf, nub )
|
||||
|
||||
import System.IO.Unsafe ( unsafePerformIO )
|
||||
import System.IO ( hGetContents )
|
||||
@ -311,35 +311,10 @@ grabDefaultPkgConf = do
|
||||
--
|
||||
readPackageConf :: FilePath -> IO [PackageConfig]
|
||||
readPackageConf f = do
|
||||
-- s <- readFile f
|
||||
-- let p = map parseInstalledPackageInfo $ splitPkgs s
|
||||
-- return $ flip map p $ \p' -> case p' of
|
||||
-- ParseFailed e -> error $ show e
|
||||
-- ParseOk _ c -> expand_libdir c
|
||||
pc <- configureAllKnownPrograms silent defaultProgramConfiguration
|
||||
pkgIndex <- getInstalledPackages silent (SpecificPackageDB f) pc
|
||||
return $ allPackages pkgIndex
|
||||
|
||||
where
|
||||
expand_libdir :: PackageConfig -> PackageConfig
|
||||
expand_libdir pk =
|
||||
let pk' = updImportDirs (\idirs -> map expand idirs) pk
|
||||
pk'' = updLibraryDirs (\ldirs -> map expand ldirs) pk'
|
||||
in pk''
|
||||
|
||||
expand :: FilePath -> FilePath
|
||||
expand s | "$libdir" `isPrefixOf` s = ghcLibraryPath ++ drop 7 s
|
||||
expand s = s
|
||||
|
||||
splitPkgs :: String -> [String]
|
||||
splitPkgs = map unlines . splitWith ("---" ==) . lines
|
||||
where
|
||||
splitWith :: (a -> Bool) -> [a] -> [[a]]
|
||||
splitWith p xs = ys : case zs of
|
||||
[] -> []
|
||||
_:ws -> splitWith p ws
|
||||
where (ys,zs) = break p xs
|
||||
|
||||
-- -----------------------------------------------------------
|
||||
-- Static package management stuff. A static package is linked with the base
|
||||
-- application and we should therefore not link with any of the DLLs it requires.
|
||||
|
@ -14,7 +14,7 @@ import Control.Concurrent (forkIO)
|
||||
import qualified Posix as P
|
||||
#endif
|
||||
|
||||
import qualified Control.Exception
|
||||
import qualified Control.OldException as E
|
||||
|
||||
--
|
||||
-- slight wrapper over popen for calls that don't care about stdin to the program
|
||||
@ -38,7 +38,7 @@ type ProcessID = ProcessHandle
|
||||
--
|
||||
popen :: FilePath -> [String] -> Maybe String -> IO (String,String,ProcessID)
|
||||
popen file args minput =
|
||||
Control.Exception.handle (\e -> return ([],show e,error (show e))) $ do
|
||||
E.handle (\e -> return ([],show e, error (show e))) $ do
|
||||
|
||||
(inp,out,err,pid) <- runInteractiveProcess file args Nothing Nothing
|
||||
|
||||
@ -55,8 +55,8 @@ popen file args minput =
|
||||
-- data gets pulled as it becomes available. you have to force the
|
||||
-- output strings before waiting for the process to terminate.
|
||||
--
|
||||
forkIO (Control.Exception.evaluate (length output) >> return ())
|
||||
forkIO (Control.Exception.evaluate (length errput) >> return ())
|
||||
forkIO (E.evaluate (length output) >> return ())
|
||||
forkIO (E.evaluate (length errput) >> return ())
|
||||
|
||||
-- And now we wait. We must wait after we read, unsurprisingly.
|
||||
exitCode <- waitForProcess pid -- blocks without -threaded, you're warned.
|
||||
@ -79,7 +79,7 @@ popen file args minput =
|
||||
--
|
||||
popen :: FilePath -> [String] -> Maybe String -> IO (String,String,P.ProcessID)
|
||||
popen f s m =
|
||||
Control.Exception.handle (\e -> return ([], show e, error $ show e )) $ do
|
||||
E.handle (\e -> return ([], show e, error $ show e )) $ do
|
||||
x@(_,_,pid) <- P.popen f s m
|
||||
b <- P.getProcessStatus True False pid -- wait
|
||||
return $ case b of
|
||||
|
Loading…
x
Reference in New Issue
Block a user