summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlarsk <>2017-08-03 15:45:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-08-03 15:45:00 (GMT)
commit3b6ee0350a2fa748e474e93ff6fb7bab971056e6 (patch)
treed822c6952672e85280266a419bc0ed1c78bcfad0
parent42f92244d035582024496ec12be0f16bf43e904b (diff)
version 0.3.00.3.0
-rw-r--r--CHANGELOG.md6
-rw-r--r--Setup.hs34
-rw-r--r--configuration-tools.cabal8
-rw-r--r--src/Configuration/Utils.hs3
-rw-r--r--src/Configuration/Utils/CommandLine.hs2
-rw-r--r--src/Configuration/Utils/Setup.hs34
6 files changed, 57 insertions, 30 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62b2ff9..18b879d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
======
diff --git a/Setup.hs b/Setup.hs
index 87a5fb6..cdb87cf 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -110,6 +110,11 @@ module Main
, 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.LocalBuildInfo
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.Directory (doesFileExist, doesDirectoryExist, createDirectoryIfMis
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,9 +194,13 @@ mkPkgInfoModulesPostConf hook args flags pkgDesc bInfo = do
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"
@@ -220,8 +230,10 @@ getVcsOfDir d = do
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 @@ pkgInfoModule cName pkgDesc bInfo = do
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
diff --git a/configuration-tools.cabal b/configuration-tools.cabal
index c4170b0..588aa2a 100644
--- a/configuration-tools.cabal
+++ b/configuration-tools.cabal
@@ -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 @@ License-file: LICENSE
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 head
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
diff --git a/src/Configuration/Utils.hs b/src/Configuration/Utils.hs
index f7cd9aa..6c81b04 100644
--- a/src/Configuration/Utils.hs
+++ b/src/Configuration/Utils.hs
@@ -367,13 +367,11 @@ pAppConfiguration mainParser = AppConfiguration
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 @@ pPkgInfo (sinfo, detailedInfo, version, license) =
where
infoO = infoOption sinfo
$ O.long "info"
- ⊕ O.short 'i'
⊕ O.help "Print program info message and exit"
⊕ O.value id
detailedInfoO = infoOption detailedInfo
diff --git a/src/Configuration/Utils/CommandLine.hs b/src/Configuration/Utils/CommandLine.hs
index 4cf9b27..324fdf4 100644
--- a/src/Configuration/Utils/CommandLine.hs
+++ b/src/Configuration/Utils/CommandLine.hs
@@ -176,7 +176,7 @@ boolReader x = case CI.mk x of
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
diff --git a/src/Configuration/Utils/Setup.hs b/src/Configuration/Utils/Setup.hs
index 494d7bc..957f814 100644
--- a/src/Configuration/Utils/Setup.hs
+++ b/src/Configuration/Utils/Setup.hs
@@ -110,6 +110,11 @@ module Configuration.Utils.Setup
, 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.LocalBuildInfo
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.Directory (doesFileExist, doesDirectoryExist, createDirectoryIfMis
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,9 +194,13 @@ mkPkgInfoModulesPostConf hook args flags pkgDesc bInfo = do
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"
@@ -220,8 +230,10 @@ getVcsOfDir d = do
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 @@ pkgInfoModule cName pkgDesc bInfo = do
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