Skip to content

Commit

Permalink
Merge branch 'main' of github.com:augustss/MicroCabal
Browse files Browse the repository at this point in the history
  • Loading branch information
augustss committed Dec 28, 2024
2 parents 4c74229 + fc3b8f8 commit e76802a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MicroCabal.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: MicroCabal
version: 0.4.0.0
version: 0.4.1.0
synopsis: A partial Cabal replacement
license: Apache-2.0
license-file: LICENSE
Expand Down
3 changes: 2 additions & 1 deletion src/MicroCabal/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import MicroCabal.Unix
--import MicroCabal.YAML

version :: String
version = "MicroCabal 0.4.0.0"
version = "MicroCabal 0.4.1.0"

main :: IO ()
main = do
Expand Down Expand Up @@ -322,6 +322,7 @@ install env = do
sect s@(Section "executable" _ _) | TgtExe `elem` targets env = installExe env glob s
sect s@(Section "library" _ _) | TgtLib `elem` targets env = installLib env glob s
sect _ = return ()
message env 3 $ "Unnormalized Cabal file:\n" ++ show cbl
message env 2 $ "Normalized Cabal file:\n" ++ show ncbl
mapM_ sect $ addMissing sects

Expand Down
9 changes: 3 additions & 6 deletions src/MicroCabal/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,12 @@ lower :: String -> String
lower = map toLower

-- Change lines with first non-space being '--' into just a newline
-- Remove '--MHS'.
-- Hackage does not recognize mhs as a valid compiler yet.
-- Work around this by having mhs stuff in comments that
-- MicroCabal ignores.
-- Also get rid of lines that end in '--NOT_MHS'
-- Remove '--MCABAL'. This is because cabal does not allow conditionals
-- for the global section, and mhs needs that.
dropCabalComments :: String -> String
dropCabalComments = unlines . map cmt . lines
where
cmt ('-':'-':'M':'H':'S':cs) = cmt cs
cmt ('-':'-':'M':'C':'A':'B':'A':'L':cs) = cmt cs
cmt s | take 2 (dropWhile (== ' ') s) == "--" = ""
| "--NOT_MHS" `isSuffixOf` s = ""
| otherwise = s
Expand Down

0 comments on commit e76802a

Please sign in to comment.