packages feed

graphmod 1.4 → 1.4.1

raw patch · 4 files changed

+36/−12 lines, 4 filesdep +pretty

Dependencies added: pretty

Files

graphmod.cabal view
@@ -1,5 +1,5 @@ name:           graphmod-version:        1.4+version:        1.4.1 license:        BSD3 license-file:   LICENSE author:         Iavor S. Diatchki@@ -12,18 +12,25 @@                 from the dependencies of a number of Haskell modules. category:       Development -tested-with:    GHC==7.10.3, GHC==7.8.4+tested-with:    GHC==7.0.1,  GHC==7.0.2,  GHC==7.0.3, GHC==7.0.4,+                GHC==7.2.1,  GHC==7.2.2,+                GHC==7.4.1,  GHC==7.4.2,+                GHC==7.6.1,  GHC==7.6.2,  GHC==7.6.3,+                GHC==7.8.1,  GHC==7.8.2,  GHC==7.8.3, GHC==7.8.4+                GHC==7.10.1, GHC==7.10.2, GHC==7.10.3+                GHC==8.0.1,  GHC==8.0.2,+                GHC==8.2.1+ extra-source-files: CHANGELOG.md  executable graphmod     main-is:         Main.hs     other-modules:   Utils, Trie, Paths_graphmod, CabalSupport     build-depends:   base < 5, directory, filepath, dotgen >= 0.2 && < 0.5,-                     haskell-lexer >= 1.0.1, containers, Cabal+                     haskell-lexer >= 1.0.1, containers, Cabal, pretty     hs-source-dirs:  src     ghc-options:     -Wall -O2  source-repository head   type:     git   location: git://github.com/yav/graphmod-
src/CabalSupport.hs view
@@ -1,3 +1,5 @@+{-# language CPP #-}+ module CabalSupport (parseCabalFile,Unit(..),UnitName(..)) where  import Utils(ModName)@@ -6,7 +8,6 @@ import System.FilePath((</>))  -- Interface to cabal.-import Distribution.PackageDescription.Parse(readPackageDescription) import Distribution.Verbosity(silent) import Distribution.PackageDescription         ( GenericPackageDescription, PackageDescription(..)@@ -14,11 +15,28 @@ import Distribution.PackageDescription.Configuration (flattenPackageDescription) import Distribution.ModuleName(ModuleName,components) +#if MIN_VERSION_Cabal(2,0,0)+import Distribution.PackageDescription.Parse(readGenericPackageDescription)+import Distribution.Types.UnqualComponentName (UnqualComponentName)+import Distribution.Text (disp)+import Text.PrettyPrint (render) +pretty :: UnqualComponentName -> String+pretty = render . disp+#else+import Distribution.PackageDescription.Parse(readPackageDescription)+import Distribution.Verbosity (Verbosity) +readGenericPackageDescription :: Verbosity -> FilePath -> IO GenericPackageDescription+readGenericPackageDescription = readPackageDescription +pretty :: String -> String+pretty = id+#endif++ parseCabalFile :: FilePath -> IO [Unit]-parseCabalFile f = fmap findUnits (readPackageDescription silent f)+parseCabalFile f = fmap findUnits (readGenericPackageDescription silent f)   -- | This is our abstraction for something in a cabal file.@@ -42,7 +60,7 @@                    }  exeUnit :: Executable -> Unit-exeUnit exe = Unit { unitName    = UnitExecutable (exeName exe)+exeUnit exe = Unit { unitName    = UnitExecutable (pretty $ exeName exe)                    , unitPaths   = hsSourceDirs (buildInfo exe)                    , unitModules = [] -- other modules?                    , unitFiles   = case hsSourceDirs (buildInfo exe) of@@ -60,5 +78,3 @@                            fmap exeUnit (executables pkg)   where   pkg = flattenPackageDescription g -- we just ignore flags--
src/Main.hs view
@@ -5,7 +5,8 @@  import Control.Monad(when,forM_,msum,guard,unless) import Control.Monad.Fix(mfix)-import Control.Exception(catch,SomeException(..))+import           Control.Exception (SomeException(..))+import qualified Control.Exception as X (catch) import Data.List(intersperse,transpose) import Data.Maybe(isJust,fromMaybe,listToMaybe) import qualified Data.IntMap as IMap@@ -444,7 +445,7 @@   do fs <- getDirectoryContents "." -- XXX      case filter ((".cabal" ==) . takeExtension) fs of        f : _ -> do units <- parseCabalFile f-                              `catch` \SomeException {} -> return []+                              `X.catch` \SomeException {} -> return []                    return (fromUnits units)        _ -> return ([],[]) fromCabal _ = return ([],[])
src/Utils.hs view
@@ -32,7 +32,7 @@ parseFile          :: FilePath -> IO (ModName,[Import]) parseFile f =   do (modName, imps) <- (parseString . get_text) `fmap` readFile f-     evaluate (length imps) -- this is here so that the file gets closed+     _ <- evaluate (length imps) -- this is here so that the file gets closed      if ext == ".imports"        then return (splitModName (takeBaseName f), imps)        else return (modName, imps)