summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2021-01-27 19:44:04 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-29 04:06:03 -0500
commit5140841ca1acaeaeef893233ae3d08ce4573b01b (patch)
tree368e28189a4b1e0e1ad8c19e7e5faff50f90b1b1
parentae8379abb8aa1defc86dc60bece70546d42af177 (diff)
downloadhaskell-5140841ca1acaeaeef893233ae3d08ce4573b01b.tar.gz
Fix check-uniques script
It was checking the old path compiler/prelude/*, outdated with the new module hierarchy. I added a sanity check to avoid this in the future.
-rwxr-xr-xutils/checkUniques/check-uniques.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/utils/checkUniques/check-uniques.py b/utils/checkUniques/check-uniques.py
index de71e72c14..dd5891b0d8 100755
--- a/utils/checkUniques/check-uniques.py
+++ b/utils/checkUniques/check-uniques.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-from __future__ import print_function
import os.path
import sys
import re
@@ -14,11 +13,8 @@ def find_uniques(source_files):
unique_re = re.compile(r"([\w\d]+)\s*=\s*mk([\w\d']+)Unique\s+(\d+)")
for f in source_files:
ms = unique_re.findall(io.open(f, encoding='utf8').read())
- for m in ms:
- name = m[0]
- _type = m[1]
- n = int(m[2])
- uniques[_type][n].add(name)
+ for name, _type, n in ms:
+ uniques[_type][int(n)].add(name)
return uniques
@@ -37,9 +33,13 @@ def find_conflicts(uniques):
]
top_dir = sys.argv[1]
-uniques = find_uniques(glob.glob(os.path.join(top_dir, 'compiler', 'prelude', '*.hs')))
+uniques = find_uniques(glob.glob(os.path.join(top_dir, 'compiler', 'GHC', '**', '*.hs'), recursive=True))
#print_all(uniques)
conflicts = find_conflicts(uniques)
+if len(uniques) < 5:
+ print("Error: check-uniques: run from wrong directory?")
+ sys.exit(1)
+
if len(conflicts) > 0:
print("Error: check-uniques: Found Unique conflict")
print()