[commit: Cabal] master: Handle -fflag options. (7ded699)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:47:06 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/7ded699b6403e1f8e3343667b7039ac23be4636d
>---------------------------------------------------------------
commit 7ded699b6403e1f8e3343667b7039ac23be4636d
Author: bjorn <bjorn at bringert.net>
Date: Mon Oct 8 20:08:32 2007 +0000
Handle -fflag options.
>---------------------------------------------------------------
cabal-install/Hackage/Dependency.hs | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/cabal-install/Hackage/Dependency.hs b/cabal-install/Hackage/Dependency.hs
index 0d5a0a6..1cfdc28 100644
--- a/cabal-install/Hackage/Dependency.hs
+++ b/cabal-install/Hackage/Dependency.hs
@@ -110,15 +110,15 @@ getDependencies comp _installed _available pkg opts
-- | Extracts configurations flags from a list of options.
configurationsFlags :: [String] -> [(String, Bool)]
-configurationsFlags opts =
- case filter ("--flags=" `isPrefixOf`) opts of
- [] -> []
- xs -> flagList $ removeQuotes $ drop 8 $ last xs
- where removeQuotes ('"':s) = take (length s - 1) s
- removeQuotes s = s
- flagList = map tagWithValue . words
- where tagWithValue ('-':name) = (map toLower name, False)
- tagWithValue name = (map toLower name, True)
+configurationsFlags = concatMap flag
+ where
+ flag o | "--flags=" `isPrefixOf` o = map tagWithValue $ words $ removeQuotes $ drop 8 o
+ | "-f" `isPrefixOf` o = [tagWithValue $ drop 2 o]
+ | otherwise = []
+ removeQuotes (c:s) | c == '"' || c == '\'' = take (length s - 1) s
+ removeQuotes s = s
+ tagWithValue ('-':name) = (map toLower name, False)
+ tagWithValue name = (map toLower name, True)
packagesToInstall :: [ResolvedPackage]
-> Either [Dependency] [(PkgInfo, [String])]
More information about the Cvs-libraries
mailing list