mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
CI: Reformat matrix.py
using black
The initial version of matrix.py was formatted using `black` [1], but with all the later changes, the formatting diverged quite a bit. This patch reformats the script using black, fixing the indentation of some statements and shortening overlong lines. [1] https://github.com/psf/black
This commit is contained in:
parent
e327e41430
commit
081091187e
40
.github/matrix.py
vendored
40
.github/matrix.py
vendored
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import re
|
|
||||||
from os import environ
|
from os import environ
|
||||||
|
|
||||||
if len(sys.argv) == 2:
|
if len(sys.argv) == 2:
|
||||||
@ -23,35 +23,43 @@ else:
|
|||||||
|
|
||||||
print("Generating matrix for branch '{}'.".format(ref_name))
|
print("Generating matrix for branch '{}'.".format(ref_name))
|
||||||
|
|
||||||
|
|
||||||
def clean_ssl(ssl):
|
def clean_ssl(ssl):
|
||||||
return ssl.replace("_VERSION", "").lower()
|
return ssl.replace("_VERSION", "").lower()
|
||||||
|
|
||||||
|
|
||||||
@functools.lru_cache(5)
|
@functools.lru_cache(5)
|
||||||
def determine_latest_openssl(ssl):
|
def determine_latest_openssl(ssl):
|
||||||
headers = {}
|
headers = {}
|
||||||
if environ.get('GITHUB_TOKEN') is not None:
|
if environ.get("GITHUB_TOKEN") is not None:
|
||||||
headers["Authorization"] = "token {}".format(environ.get('GITHUB_TOKEN'))
|
headers["Authorization"] = "token {}".format(environ.get("GITHUB_TOKEN"))
|
||||||
|
|
||||||
request = urllib.request.Request('https://api.github.com/repos/openssl/openssl/tags', headers=headers)
|
request = urllib.request.Request(
|
||||||
|
"https://api.github.com/repos/openssl/openssl/tags", headers=headers
|
||||||
|
)
|
||||||
openssl_tags = urllib.request.urlopen(request)
|
openssl_tags = urllib.request.urlopen(request)
|
||||||
tags = json.loads(openssl_tags.read().decode('utf-8'))
|
tags = json.loads(openssl_tags.read().decode("utf-8"))
|
||||||
latest_tag = ''
|
latest_tag = ""
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
name = tag['name']
|
name = tag["name"]
|
||||||
if "openssl-" in name:
|
if "openssl-" in name:
|
||||||
if name > latest_tag:
|
if name > latest_tag:
|
||||||
latest_tag = name
|
latest_tag = name
|
||||||
return "OPENSSL_VERSION={}".format(latest_tag[8:])
|
return "OPENSSL_VERSION={}".format(latest_tag[8:])
|
||||||
|
|
||||||
|
|
||||||
@functools.lru_cache(5)
|
@functools.lru_cache(5)
|
||||||
def determine_latest_libressl(ssl):
|
def determine_latest_libressl(ssl):
|
||||||
libressl_download_list = urllib.request.urlopen("http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/")
|
libressl_download_list = urllib.request.urlopen(
|
||||||
|
"http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/"
|
||||||
|
)
|
||||||
for line in libressl_download_list.readlines():
|
for line in libressl_download_list.readlines():
|
||||||
decoded_line = line.decode("utf-8")
|
decoded_line = line.decode("utf-8")
|
||||||
if "libressl-" in decoded_line and ".tar.gz.asc" in decoded_line:
|
if "libressl-" in decoded_line and ".tar.gz.asc" in decoded_line:
|
||||||
l = re.split("libressl-|.tar.gz.asc", decoded_line)[1]
|
l = re.split("libressl-|.tar.gz.asc", decoded_line)[1]
|
||||||
return "LIBRESSL_VERSION={}".format(l)
|
return "LIBRESSL_VERSION={}".format(l)
|
||||||
|
|
||||||
|
|
||||||
def clean_compression(compression):
|
def clean_compression(compression):
|
||||||
return compression.replace("USE_", "").lower()
|
return compression.replace("USE_", "").lower()
|
||||||
|
|
||||||
@ -115,7 +123,7 @@ for CC in ["gcc", "clang"]:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# ASAN
|
# ASAN
|
||||||
|
|
||||||
matrix.append(
|
matrix.append(
|
||||||
{
|
{
|
||||||
@ -150,9 +158,7 @@ for CC in ["gcc", "clang"]:
|
|||||||
for compression in ["USE_ZLIB=1"]:
|
for compression in ["USE_ZLIB=1"]:
|
||||||
matrix.append(
|
matrix.append(
|
||||||
{
|
{
|
||||||
"name": "{}, {}, gz={}".format(
|
"name": "{}, {}, gz={}".format(os, CC, clean_compression(compression)),
|
||||||
os, CC, clean_compression(compression)
|
|
||||||
),
|
|
||||||
"os": os,
|
"os": os,
|
||||||
"TARGET": TARGET,
|
"TARGET": TARGET,
|
||||||
"CC": CC,
|
"CC": CC,
|
||||||
@ -165,7 +171,7 @@ for CC in ["gcc", "clang"]:
|
|||||||
"OPENSSL_VERSION=1.0.2u",
|
"OPENSSL_VERSION=1.0.2u",
|
||||||
"OPENSSL_VERSION=1.1.1s",
|
"OPENSSL_VERSION=1.1.1s",
|
||||||
"QUICTLS=yes",
|
"QUICTLS=yes",
|
||||||
# "BORINGSSL=yes",
|
# "BORINGSSL=yes",
|
||||||
]
|
]
|
||||||
|
|
||||||
if "haproxy-" not in ref_name:
|
if "haproxy-" not in ref_name:
|
||||||
@ -220,6 +226,6 @@ for CC in ["clang"]:
|
|||||||
|
|
||||||
print(json.dumps(matrix, indent=4, sort_keys=True))
|
print(json.dumps(matrix, indent=4, sort_keys=True))
|
||||||
|
|
||||||
if environ.get('GITHUB_OUTPUT') is not None:
|
if environ.get("GITHUB_OUTPUT") is not None:
|
||||||
with open(environ.get('GITHUB_OUTPUT'), 'a') as f:
|
with open(environ.get("GITHUB_OUTPUT"), "a") as f:
|
||||||
print("matrix={}".format(json.dumps({"include": matrix})), file=f)
|
print("matrix={}".format(json.dumps({"include": matrix})), file=f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user