graphviz 2999.14.0.0 → 2999.14.1.0
raw patch · 3 files changed
+32/−3 lines, 3 filesdep +directoryPVP ok
version bump matches the API change (PVP)
Dependencies added: directory
API changes (from Hackage documentation)
+ Data.GraphViz.Commands: isGraphvizInstalled :: IO Bool
+ Data.GraphViz.Commands: quitWithoutGraphviz :: String -> IO ()
Files
- Changelog +8/−0
- Data/GraphViz/Commands.hs +22/−2
- graphviz.cabal +2/−1
Changelog view
@@ -7,6 +7,14 @@ The following is information about what major changes have gone into each release. +Changes in 2999.14.1.0+----------------------++* Add `isGraphvizInstalled` and `quitWithoutGraphviz` for programs to+ test whether Graphviz has been installed (as previous attempts at+ doing so via actual calls to dot, neato, etc. weren't working and+ would be too verbose anyway).+ Changes in 2999.14.0.0 ----------------------
Data/GraphViz/Commands.hs view
@@ -40,6 +40,9 @@ , runGraphvizCanvas , runGraphvizCanvas' , graphvizWithHandle+ -- * Testing if Graphviz is installed+ , isGraphvizInstalled+ , quitWithoutGraphviz ) where -- Want to use the extensible-exception version@@ -52,9 +55,12 @@ import Data.GraphViz.Exception import qualified Data.ByteString as SB-import System.IO(Handle, hSetBinaryMode)-import Control.Monad(liftM)+import Data.Maybe(isJust)+import System.IO(Handle, hSetBinaryMode, hPutStrLn, stderr)+import Control.Monad(liftM, unless) import System.FilePath((<.>))+import System.Directory(findExecutable)+import System.Exit(ExitCode(..), exitWith) -- ----------------------------------------------------------------------------- @@ -316,3 +322,17 @@ -- using the given canvas type. runGraphvizCanvas' :: (PrintDotRepr dg n) => dg n -> GraphvizCanvas -> IO () runGraphvizCanvas' d = runGraphvizCanvas (commandFor d) d++-- -----------------------------------------------------------------------------++-- | Is the Graphviz suite of tools installed? This is determined by+-- whether @dot@ is available in the @PATH@.+isGraphvizInstalled :: IO Bool+isGraphvizInstalled = liftM isJust . findExecutable $ showCmd Dot++-- | If Graphviz does not seem to be available, print the provided+-- error message and then exit fatally.+quitWithoutGraphviz :: String -> IO ()+quitWithoutGraphviz err = do hasGraphviz <- isGraphvizInstalled+ unless hasGraphviz+ $ hPutStrLn stderr err >> exitWith (ExitFailure 1)
graphviz.cabal view
@@ -1,5 +1,5 @@ Name: graphviz-Version: 2999.14.0.0+Version: 2999.14.1.0 Stability: Beta Synopsis: Bindings to Graphviz for graph visualisation. Description: {@@ -56,6 +56,7 @@ Build-Depends: base == 4.*, containers, process,+ directory, fgl == 5.4.*, filepath, polyparse >= 1.7 && < 1.9,