|
| 1 | +import json |
1 | 2 | import os |
2 | 3 | import sys |
3 | 4 |
|
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") |
7 | 7 |
|
8 | | -import gen_ghc_bindist |
9 | 8 |
|
10 | 9 | 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) |
15 | 14 |
|
16 | | -version_numbers = [x['version'] for x in gen_ghc_bindist.VERSIONS] |
17 | 15 |
|
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()) |
19 | 20 |
|
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 | +) |
22 | 26 |
|
| 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