Skip to content

Commit

Permalink
Merge pull request #2011 from tweag/fix-test-ghc-patches
Browse files Browse the repository at this point in the history
Fix extract_from_ghc_bindist.py
  • Loading branch information
mergify[bot] authored Nov 7, 2023
2 parents 75de1e4 + 6035331 commit dacc6f0
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/extract_from_ghc_bindist.py
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))

0 comments on commit dacc6f0

Please sign in to comment.