configuration-tools 0.2.15 → 0.3.0
raw patch · 6 files changed
+57/−30 lines, 6 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- Setup.hs +23/−11
- configuration-tools.cabal +4/−4
- src/Configuration/Utils.hs +0/−3
- src/Configuration/Utils/CommandLine.hs +1/−1
- src/Configuration/Utils/Setup.hs +23/−11
CHANGELOG.md view
@@ -1,3 +1,9 @@+0.3.0+=====++* Remove built in short options `-p`, `-c`, and `-i`+* Support CHG-8.2 and Cabal-2.0+ 0.2.15 ======
Setup.hs view
@@ -110,6 +110,11 @@ , mkPkgInfoModules ) where +#ifndef MIN_VERSION_Cabal+#define NO_CABAL_MACROS 1+#define MIN_VERSION_Cabal(a,b,c) 0+#endif+ import Distribution.PackageDescription import Distribution.Simple import Distribution.Simple.Setup@@ -118,6 +123,12 @@ import Distribution.Simple.BuildPaths import Distribution.Simple.PackageIndex import Distribution.Text++#if MIN_VERSION_Cabal(2,0,0)+import Distribution.Types.LocalBuildInfo+import Distribution.Types.UnqualComponentName+#endif+ import System.Process import Control.Applicative@@ -135,11 +146,6 @@ import System.FilePath (isDrive, (</>), takeDirectory) import System.Exit (ExitCode(ExitSuccess)) -#ifndef MIN_VERSION_Cabal-#define NO_CABAL_MACROS 1-#define MIN_VERSION_Cabal(a,b,c) 0-#endif- #ifdef NO_CABAL_MACROS import Data.Maybe import Data.Typeable@@ -188,10 +194,14 @@ mkModules = mapM_ (f . \(a,_,_) -> a) $ componentsConfigs bInfo f cname = case cname of CLibName -> updatePkgInfoModule Nothing pkgDesc bInfo- CExeName s -> updatePkgInfoModule (Just s) pkgDesc bInfo- CTestName s -> updatePkgInfoModule (Just s) pkgDesc bInfo- CBenchName s -> updatePkgInfoModule (Just s) pkgDesc bInfo+ CExeName s -> updatePkgInfoModule (Just $ unUnqualComponentName s) pkgDesc bInfo+ CTestName s -> updatePkgInfoModule (Just $ unUnqualComponentName s) pkgDesc bInfo+ CBenchName s -> updatePkgInfoModule (Just $ unUnqualComponentName s) pkgDesc bInfo +#if !MIN_VERSION_Cabal(2,0,0)+ unUnqualComponentName = id+#endif+ pkgInfoModuleName :: Maybe String -> String pkgInfoModuleName Nothing = "PkgInfo" pkgInfoModuleName (Just cn) = "PkgInfo_" ++ map tr cn@@ -220,8 +230,10 @@ then return Nothing else getVcsOfDir (takeDirectory canonicDir) -flagNameStr :: FlagName -> String-flagNameStr (FlagName s) = s+#if !MIN_VERSION_Cabal(2,0,0)+unFlagName :: FlagName -> String+unFlagName (FlagName s) = s+#endif pkgInfoModule :: Maybe String -> PackageDescription -> LocalBuildInfo -> IO B.ByteString pkgInfoModule cName pkgDesc bInfo = do@@ -232,7 +244,7 @@ let vcsBranch = if branch == "default" || branch == "master" then "" else branch vcsVersion = intercalate "-" . filter (/= "") $ [tag, revision, vcsBranch]- flags = map (flagNameStr . fst) . filter snd . configConfigurationsFlags . configFlags $ bInfo+ flags = map (unFlagName . fst) . filter snd . configConfigurationsFlags . configFlags $ bInfo licenseString <- licenseFilesText pkgDesc
configuration-tools.cabal view
@@ -1,10 +1,10 @@ -- ------------------------------------------------------ ----- Copyright © 2015-2016 Lars Kuhtz <lakuhtz@gmail.com>+-- Copyright © 2015-2017 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright © 2014-2015 AlephCloud Systems, Inc. -- ------------------------------------------------------ -- Name: configuration-tools-Version: 0.2.15+Version: 0.3.0 Synopsis: Tools for specifying and parsing configurations description: Tools for specifying and parsing configurations@@ -35,7 +35,7 @@ Author: Lars Kuhtz <lakuhtz@gmail.com> Maintainer: Lars Kuhtz <lakuhtz@gmail.com> Copyright:- (c) 2015-2016 Lars Kuhtz <lakuhtz@gmail.com>,+ (c) 2015-2017 Lars Kuhtz <lakuhtz@gmail.com>, (c) 2014-2015 AlephCloud, Inc. Category: Configuration, Console Build-type: Custom@@ -58,7 +58,7 @@ source-repository this type: git location: https://github.com/alephcloud/hs-configuration-tools.git- tag: 0.2.15+ tag: 0.3.0 flag remote-configs Description: enable loading of configuration files from HTTP URLs
src/Configuration/Utils.hs view
@@ -367,13 +367,11 @@ where pPrintConfig = O.switch × O.long "print-config"- ⊕ O.short 'p' ⊕ O.help "Print the parsed configuration to standard out and exit" ⊕ O.showDefault pConfigFile = ConfigFileRequired ∘ T.pack <$> O.strOption × O.long "config-file"- ⊕ O.short 'c' ⊕ O.metavar "FILE" ⊕ O.help "Configuration file in YAML or JSON format. If more than a single config file option is present files are loaded in the order in which they appear on the command line." @@ -428,7 +426,6 @@ where infoO = infoOption sinfo $ O.long "info"- ⊕ O.short 'i' ⊕ O.help "Print program info message and exit" ⊕ O.value id detailedInfoO = infoOption detailedInfo
src/Configuration/Utils/CommandLine.hs view
@@ -176,7 +176,7 @@ boolOption ∷ O.Mod O.OptionFields Bool → O.Parser Bool-boolOption mods = O.option (O.eitherReader boolReader)+boolOption mods = O.option (O.eitherReader (boolReader ∷ String → Either String Bool)) × O.metavar "true|false" ⊕ O.completeWith ["true", "false", "TRUE", "FALSE", "True", "False"] ⊕ mods
src/Configuration/Utils/Setup.hs view
@@ -110,6 +110,11 @@ , mkPkgInfoModules ) where +#ifndef MIN_VERSION_Cabal+#define NO_CABAL_MACROS 1+#define MIN_VERSION_Cabal(a,b,c) 0+#endif+ import Distribution.PackageDescription import Distribution.Simple import Distribution.Simple.Setup@@ -118,6 +123,12 @@ import Distribution.Simple.BuildPaths import Distribution.Simple.PackageIndex import Distribution.Text++#if MIN_VERSION_Cabal(2,0,0)+import Distribution.Types.LocalBuildInfo+import Distribution.Types.UnqualComponentName+#endif+ import System.Process import Control.Applicative@@ -135,11 +146,6 @@ import System.FilePath (isDrive, (</>), takeDirectory) import System.Exit (ExitCode(ExitSuccess)) -#ifndef MIN_VERSION_Cabal-#define NO_CABAL_MACROS 1-#define MIN_VERSION_Cabal(a,b,c) 0-#endif- #ifdef NO_CABAL_MACROS import Data.Maybe import Data.Typeable@@ -188,10 +194,14 @@ mkModules = mapM_ (f . \(a,_,_) -> a) $ componentsConfigs bInfo f cname = case cname of CLibName -> updatePkgInfoModule Nothing pkgDesc bInfo- CExeName s -> updatePkgInfoModule (Just s) pkgDesc bInfo- CTestName s -> updatePkgInfoModule (Just s) pkgDesc bInfo- CBenchName s -> updatePkgInfoModule (Just s) pkgDesc bInfo+ CExeName s -> updatePkgInfoModule (Just $ unUnqualComponentName s) pkgDesc bInfo+ CTestName s -> updatePkgInfoModule (Just $ unUnqualComponentName s) pkgDesc bInfo+ CBenchName s -> updatePkgInfoModule (Just $ unUnqualComponentName s) pkgDesc bInfo +#if !MIN_VERSION_Cabal(2,0,0)+ unUnqualComponentName = id+#endif+ pkgInfoModuleName :: Maybe String -> String pkgInfoModuleName Nothing = "PkgInfo" pkgInfoModuleName (Just cn) = "PkgInfo_" ++ map tr cn@@ -220,8 +230,10 @@ then return Nothing else getVcsOfDir (takeDirectory canonicDir) -flagNameStr :: FlagName -> String-flagNameStr (FlagName s) = s+#if !MIN_VERSION_Cabal(2,0,0)+unFlagName :: FlagName -> String+unFlagName (FlagName s) = s+#endif pkgInfoModule :: Maybe String -> PackageDescription -> LocalBuildInfo -> IO B.ByteString pkgInfoModule cName pkgDesc bInfo = do@@ -232,7 +244,7 @@ let vcsBranch = if branch == "default" || branch == "master" then "" else branch vcsVersion = intercalate "-" . filter (/= "") $ [tag, revision, vcsBranch]- flags = map (flagNameStr . fst) . filter snd . configConfigurationsFlags . configFlags $ bInfo+ flags = map (unFlagName . fst) . filter snd . configConfigurationsFlags . configFlags $ bInfo licenseString <- licenseFilesText pkgDesc