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(..) ) ...@@ -67,7 +67,7 @@ import Language.Haskell.Extension ( Language(..) )
import Distribution.Client.Init.Types import Distribution.Client.Init.Types
( InitFlags(..), PackageType(..), Category(..) ) ( InitFlags(..), PackageType(..), Category(..) )
import Distribution.Client.Init.Licenses 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 import Distribution.Client.Init.Heuristics
( guessPackageName, guessAuthorNameMail, SourceFileEntry(..), ( guessPackageName, guessAuthorNameMail, SourceFileEntry(..),
scanForModules, neededBuildPrograms ) scanForModules, neededBuildPrograms )
...@@ -534,14 +534,15 @@ readMaybe s = case reads s of ...@@ -534,14 +534,15 @@ readMaybe s = case reads s of
writeLicense :: InitFlags -> IO () writeLicense :: InitFlags -> IO ()
writeLicense flags = do writeLicense flags = do
message flags "\nGenerating LICENSE..." message flags "\nGenerating LICENSE..."
year <- getYear year <- show <$> getYear
let authors = fromMaybe "???" . flagToMaybe . author $ flags
let licenseFile = let licenseFile =
case license flags of case license flags of
Flag BSD3 -> Just $ bsd3 (fromMaybe "???" Flag BSD2
. flagToMaybe -> Just $ bsd2 authors year
. author
$ flags) Flag BSD3
(show year) -> Just $ bsd3 authors year
Flag (GPL (Just (Version {versionBranch = [2]}))) Flag (GPL (Just (Version {versionBranch = [2]})))
-> Just gplv2 -> Just gplv2
...@@ -561,6 +562,9 @@ writeLicense flags = do ...@@ -561,6 +562,9 @@ writeLicense flags = do
Flag (Apache (Just (Version {versionBranch = [2, 0]}))) Flag (Apache (Just (Version {versionBranch = [2, 0]})))
-> Just apache20 -> Just apache20
Flag (MPL (Version {versionBranch = [2, 0]}))
-> Just mpl20
_ -> Nothing _ -> Nothing
case licenseFile of 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