[commit: ghc] ghc-8.4: relnotes: Fix parsing of Version: field from Cabal file (c3a45d5)

git at git.haskell.org git at git.haskell.org
Sun Mar 25 19:45:31 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.4
Link       : http://ghc.haskell.org/trac/ghc/changeset/c3a45d5e8272b3e9f6f0fcb2f0cf93141d06a26a/ghc

>---------------------------------------------------------------

commit c3a45d5e8272b3e9f6f0fcb2f0cf93141d06a26a
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Mar 19 13:31:46 2018 -0400

    relnotes: Fix parsing of Version: field from Cabal file
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4491
    
    (cherry picked from commit d718023e86c8681b87f212bd64eb6ca10ac8935e)


>---------------------------------------------------------------

c3a45d5e8272b3e9f6f0fcb2f0cf93141d06a26a
 docs/users_guide/ghc_packages.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/users_guide/ghc_packages.py b/docs/users_guide/ghc_packages.py
index d4a688b..6419834 100644
--- a/docs/users_guide/ghc_packages.py
+++ b/docs/users_guide/ghc_packages.py
@@ -8,13 +8,13 @@ from utils import build_table_from_list
 def read_cabal_file(pkg_path):
     import re
     cabal_file = open(pkg_path, 'r').read()
-    pkg_name = re.search(r'[nN]ame:\s*([-a-zA-Z0-9]+)', cabal_file)
+    pkg_name = re.search(r'^[nN]ame\s*:\s*([-a-zA-Z0-9]+)', cabal_file, re.MULTILINE)
     if pkg_name is not None:
         pkg_name = pkg_name.group(1)
     else:
         raise RuntimeError("Failed to parse `Name:` field from %s" % pkg_path)
 
-    pkg_version = re.search(r'[vV]ersion:\s*(\d+(\.\d+)*)', cabal_file)
+    pkg_version = re.search(r'^[vV]ersion\s*:\s*(\d+(\.\d+)*)', cabal_file, re.MULTILINE)
     if pkg_version is not None:
         pkg_version = pkg_version.group(1)
     else:



More information about the ghc-commits mailing list