Skip to content

Commit dacc6f0

Browse files
authored
Merge pull request #2011 from tweag/fix-test-ghc-patches
Fix extract_from_ghc_bindist.py
2 parents 75de1e4 + 6035331 commit dacc6f0

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1+
import json
12
import os
23
import sys
34

4-
current_dir = os.path.dirname( __file__ )
5-
haskell_dir = os.path.join( current_dir, '..', 'haskell')
6-
sys.path.append( haskell_dir )
5+
current_dir = os.path.dirname(__file__)
6+
haskell_dir = os.path.join(current_dir, "..", "haskell")
77

8-
import gen_ghc_bindist
98

109
def unexpected(unexpected, l, error_message):
11-
for a in unexpected:
12-
if a in l:
13-
print(error_message, file=sys.stderr)
14-
list.remove(a)
10+
for a in unexpected:
11+
if a in l:
12+
print(error_message, file=sys.stderr)
13+
list.remove(a)
1514

16-
version_numbers = [x['version'] for x in gen_ghc_bindist.VERSIONS]
1715

18-
unexpected(["8.10.1", "8.10.2"], version_numbers, "GHC 8.10.1 and 8.10.2 not supported. Upgrade to 8.10.3 or later.")
16+
with open(
17+
os.path.join(haskell_dir, "private", "ghc_bindist_generated.json"), mode="rb"
18+
) as f:
19+
version_numbers = list(json.load(f).keys())
1920

20-
with open(os.environ['GITHUB_OUTPUT'], mode='a', encoding='utf-8') as output:
21-
output.write("ghc-matrix={}\n".format(version_numbers))
21+
unexpected(
22+
["8.10.1", "8.10.2"],
23+
version_numbers,
24+
"GHC 8.10.1 and 8.10.2 not supported. Upgrade to 8.10.3 or later.",
25+
)
2226

27+
with open(os.environ["GITHUB_OUTPUT"], mode="a", encoding="utf-8") as output:
28+
output.write("ghc-matrix={}\n".format(version_numbers))

0 commit comments

Comments
 (0)