-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2011 from tweag/fix-test-ghc-patches
Fix extract_from_ghc_bindist.py
- Loading branch information
Showing
1 changed file
with
18 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
import json | ||
import os | ||
import sys | ||
|
||
current_dir = os.path.dirname( __file__ ) | ||
haskell_dir = os.path.join( current_dir, '..', 'haskell') | ||
sys.path.append( haskell_dir ) | ||
current_dir = os.path.dirname(__file__) | ||
haskell_dir = os.path.join(current_dir, "..", "haskell") | ||
|
||
import gen_ghc_bindist | ||
|
||
def unexpected(unexpected, l, error_message): | ||
for a in unexpected: | ||
if a in l: | ||
print(error_message, file=sys.stderr) | ||
list.remove(a) | ||
for a in unexpected: | ||
if a in l: | ||
print(error_message, file=sys.stderr) | ||
list.remove(a) | ||
|
||
version_numbers = [x['version'] for x in gen_ghc_bindist.VERSIONS] | ||
|
||
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.") | ||
with open( | ||
os.path.join(haskell_dir, "private", "ghc_bindist_generated.json"), mode="rb" | ||
) as f: | ||
version_numbers = list(json.load(f).keys()) | ||
|
||
with open(os.environ['GITHUB_OUTPUT'], mode='a', encoding='utf-8') as output: | ||
output.write("ghc-matrix={}\n".format(version_numbers)) | ||
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.", | ||
) | ||
|
||
with open(os.environ["GITHUB_OUTPUT"], mode="a", encoding="utf-8") as output: | ||
output.write("ghc-matrix={}\n".format(version_numbers)) |