Commit 1e534d1a authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Support MPL-2.0 and BSD2 in 'cabal init'.

parent cb61663a
......@@ -67,7 +67,7 @@ import Language.Haskell.Extension ( Language(..) )
import Distribution.Client.Init.Types
( InitFlags(..), PackageType(..), Category(..) )
import Distribution.Client.Init.Licenses
( bsd3, gplv2, gplv3, lgpl2, lgpl3, agplv3, apache20 )
( bsd2, bsd3, gplv2, gplv3, lgpl2, lgpl3, agplv3, apache20, mpl20 )
import Distribution.Client.Init.Heuristics
( guessPackageName, guessAuthorNameMail, SourceFileEntry(..),
scanForModules, neededBuildPrograms )
......@@ -534,14 +534,15 @@ readMaybe s = case reads s of
writeLicense :: InitFlags -> IO ()
writeLicense flags = do
message flags "\nGenerating LICENSE..."
year <- getYear
year <- show <$> getYear
let authors = fromMaybe "???" . flagToMaybe . author $ flags
let licenseFile =
case license flags of
Flag BSD3 -> Just $ bsd3 (fromMaybe "???"
. flagToMaybe
. author
$ flags)
(show year)
Flag BSD2
-> Just $ bsd2 authors year
Flag BSD3
-> Just $ bsd3 authors year
Flag (GPL (Just (Version {versionBranch = [2]})))
-> Just gplv2
......@@ -561,6 +562,9 @@ writeLicense flags = do
Flag (Apache (Just (Version {versionBranch = [2, 0]})))
-> Just apache20
Flag (MPL (Version {versionBranch = [2, 0]}))
-> Just mpl20
_ -> Nothing
case licenseFile of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment