packages feed

diagrams-haddock 0.4.1 → 0.4.1.1

raw patch · 3 files changed

+19/−44 lines, 3 filesdep ~Cabaldep ~basedep ~lensPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: Cabal, base, lens

API changes (from Hackage documentation)

Files

CHANGES.md view
@@ -1,3 +1,7 @@+## [v0.4.1.1](https://github.com/diagrams/diagrams-haddock/tree/v0.4.1.1) (2021-11-09)++- Allow `Cabal-3.6`+ ## [v0.4.1](https://github.com/diagrams/diagrams-haddock/tree/v0.4.1) (2021-08-12)  - Allow `base-4.15`, `bytestring-0.11`, `strict-0.4`, `lens-5.0`,
diagrams-haddock.cabal view
@@ -1,5 +1,5 @@ name:                diagrams-haddock-version:             0.4.1+version:             0.4.1.1 synopsis:            Preprocessor for embedding diagrams in Haddock documentation description:         diagrams-haddock is a tool for compiling embedded inline                      diagrams code in Haddock documentation, for an@@ -15,7 +15,7 @@                      diagrams-haddock, see the diagrams-contrib                      package                      (<http://hackage.haskell.org/package/diagrams%2Dcontrib>).-homepage:            http://projects.haskell.org/diagrams/+homepage:            https://diagrams.github.io/ license:             BSD3 license-file:        LICENSE author:              Brent Yorgey@@ -69,7 +69,7 @@                        filepath,                        diagrams-haddock,                        cmdargs >= 0.8 && < 0.11,-                       Cabal >= 1.14 && < 3.5,+                       Cabal >= 2.2 && < 3.7,                        cpphs >= 1.15   hs-source-dirs:      tools   default-language:    Haskell2010
tools/diagrams-haddock.hs view
@@ -17,49 +17,18 @@ import           Distribution.Simple.LocalBuildInfo (localPkgDescr) import           Distribution.Simple.Utils          (cabalVersion) +#if MIN_VERSION_Cabal(3,6,0)+import           Distribution.Utils.Path            (getSymbolicPath)+#endif+ import           Language.Preprocessor.Cpphs  import           Paths_diagrams_haddock             (version) ---------------------------------------------------------------- This is officially an awful mess.------ In Cabal < 2.0, it used the Version type from Data.Version.------ As of Cabal 2.0, Cabal switched to its own Version type in--- Distribution.Version, and re-exported a 'showVersion' function.------ As of Cabal 2.2, showVersion became deprecated and a 'prettyShow'--- function was added;  Version moved to Distribution.Types.Version.------ We need to show both Cabal versions and Data.Version--- versions, hence the CPP mess below.---- 1. We definitely need Data.Version. Import it qualified. import qualified Data.Version                       as V---- 2. Import the proper 'Version' type to refer to Cabal versions, and--- the proper function for showing it.-#if MIN_VERSION_Cabal(2,2,0) import           Distribution.Types.Version         (Version) import           Distribution.Pretty                (prettyShow)-#elif MIN_VERSION_Cabal(2,0,0)-import           Distribution.Version               (Version)-import qualified Distribution.Version               as DV-#else-import           Data.Version                       (Version)-#endif --- 3. Define a function for showing Cabal versions.-showCabalVersion :: Version -> String-#if   MIN_VERSION_Cabal(2,2,0)-showCabalVersion = prettyShow-#elif MIN_VERSION_Cabal(2,0,0)-showCabalVersion = DV.showVersion-#else-showCabalVersion = V.showVersion-#endif- ------------------------------------------------------------ ------------------------------------------------------------ @@ -119,7 +88,7 @@   &= program "diagrams-haddock"   &= summary (unlines        [ "diagrams-haddock v" ++ V.showVersion version ++ ", (c) 2013-2016 diagrams-haddock team (see LICENSE)"-       , "compiled using version " ++ showCabalVersion cabalVersion ++ " of the Cabal library"+       , "compiled using version " ++ prettyShow cabalVersion ++ " of the Cabal library"        , ""        , "Compile inline diagrams code in Haddock documentation."        , ""@@ -175,7 +144,7 @@       , "Either it does not exist or it is in the wrong format."       , "* You may need to run 'cabal configure' first."       , "* Make sure that the version of Cabal used to compile"-      , "  diagrams-haddock (" ++ showCabalVersion cabalVersion ++ ") matches the version used"+      , "  diagrams-haddock (" ++ prettyShow cabalVersion ++ ") matches the version used"       , "  by the cabal tool."       , "* Use the -d option if you want diagrams-haddock to look in"       , "  a different dist directory."@@ -186,19 +155,21 @@         Nothing -> return ()         Just lib -> do           let buildInfo = P.libBuildInfo lib+#if MIN_VERSION_Cabal(3,6,0)+              srcDirs   = map getSymbolicPath (P.hsSourceDirs buildInfo)+#else               srcDirs   = P.hsSourceDirs buildInfo+#endif               incls     = P.includeDirs buildInfo               defns     = P.cppOptions buildInfo               opts' = opts                     { includeDirs = includeDirs opts ++ incls                     }               cabalDefines = parseCabalDefines defns-          mapM_ (tryProcessFile opts' cabalDefines dir srcDirs) . map toFilePath . P.exposedModules $ lib+          mapM_ (tryProcessFile opts' cabalDefines dir srcDirs . toFilePath) . P.exposedModules $ lib  getHsenv :: IO (Maybe String)-getHsenv = do-  env <- getEnvironment-  return $ lookup "HSENV_NAME" env+getHsenv = lookup "HSENV_NAME" <$> getEnvironment  -- | Use @cpphs@'s options parser to handle the options from cabal. parseCabalDefines :: [String] -> [(String,String)]