packages feed

music-util 0.9.2 → 0.9.3

raw patch · 2 files changed

+30/−5 lines, 2 filesdep +split

Dependencies added: split

Files

music-util.cabal view
@@ -1,6 +1,6 @@  name:               music-util-version:            0.9.2+version:            0.9.3 cabal-version:      >= 1.10 author:             Hans Hoglund maintainer:         Hans Hoglund <hans@hanshoglund.se>@@ -25,6 +25,7 @@         containers,         shelly,         process,+        split,          -- If enabled, add HAS_GRAPHVIZ flag         -- graphviz,
src/music-util.hs view
@@ -13,9 +13,10 @@ import Data.GraphViz.Attributes.Complete #endif -import System.Process (system)+import System.Process (system, runInteractiveCommand) import Control.Monad import qualified Data.List                             as List+import           Data.List.Split import           Data.Map                              (Map) import qualified Data.Map                              as Map import           Data.Maybe@@ -30,6 +31,9 @@ import           Distribution.Verbosity                (silent) import           Shelly import qualified System.Environment                    as E+import Data.Version (showVersion)+import qualified Paths_music_util                      as Paths+import System.IO (hGetContents) default (T.Text)  main = shelly $ verbosely $ main2@@ -164,6 +168,7 @@         "graph"     -> graph args         "foreach"   -> forEach args         "setup"     -> setup args+        "package-path" -> packagePath args         "help"      -> usage         _           -> echo "Unknown command, try music-util help"                                                                  @@ -179,6 +184,7 @@     echo $ "   setup sandbox      Setup the sandbox"     echo $ "   install <package>  Reinstall the given package and its dependencies"     echo $ "   foreach <command>  Run a command in each source directory"+    echo $ "   package-path       Print a suitable GHC_PACKAGE_PATH value for use with runhaskell etc"     echo $ "   document           Generate and upload documentation"     echo $ "                        --reinstall-transf  Reinstall the transf package"     echo $ "                        --no-api            Skip creating the API documentation"@@ -188,7 +194,8 @@  printVersion :: [String] -> Sh () printVersion _ = do-    echo $ "music-util, version 0.9.2"+    prg <- liftIO $ E.getProgName+    echo $ fromString prg <> ", version " <> fromString (showVersion Paths.version)  setup :: [String] -> Sh () setup ("clone":_)   = setupClone (return ())@@ -244,6 +251,18 @@     liftIO $ system $ "git clone git@github.com:music-suite/" <> name <> ".git"     return () +packagePath :: [String] -> Sh ()+packagePath _ = liftIO $ getPackagePath >>= putStr++-- | TODO Hack , see <https://mappend.net/posts/ghc-and-cabal-sandbox-playing-ni>+getPackagePath :: IO String+getPackagePath = do+    (_, out, _, _) <- runInteractiveCommand $ "cd $MUSIC_SUITE_DIR/music-preludes; cabal sandbox hc-pkg list | grep \\: |  awk '{print NR,$0}' | sort -nr | sed 's/^[0-9]* //' | sed 's/://' | paste -d: - -"+    fmap (replace "\n" "") $ hGetContents out++getPrimaryPackagePath :: IO String+getPrimaryPackagePath = fmap (takeWhile (/= ':')) getPackagePath+ list :: [String] -> Sh () list _ = mapM_ (echo . fromString) packages @@ -383,9 +402,11 @@     mkdir_p "musicsuite.github.io/docs/api/src"      path <- liftIO $ getEnvOr "MUSIC_SUITE_DIR" ""-+    -- let packDbPath = fromString path <> "/music-sandbox/x86_64-osx-ghc-7.6.3-packages.conf.d"+    packDbPath <- liftIO (fmap fromString getPrimaryPackagePath)+         -- TODO generate this-    let packDb = ["--package-db"::Text, fromString path <> "/music-sandbox/x86_64-osx-ghc-7.6.3-packages.conf.d"]+    let packDb = ["--package-db"::Text, packDbPath]     let out    = ["-o", fromString path <> "/musicsuite.github.io/docs/api"]     run "standalone-haddock" $ concat [packDb, out, fmap fromString realPackages]     return ()@@ -452,4 +473,7 @@ red    s = "\x1b[31m" <> s <> "\x1b[0m" green  s = "\x1b[32m" <> s <> "\x1b[0m" yellow s = "\x1b[33m" <> s <> "\x1b[0m"++replace :: Eq a => [a] -> [a] -> [a] -> [a]+replace old new = List.intercalate new . splitOn old