mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-09 20:41:04 -04:00
chore: update check_lib_versions.py
to use gh api
This commit is contained in:
parent
3ae2241e11
commit
b74d5d6f9a
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import requests
|
import json
|
||||||
|
import subprocess
|
||||||
|
|
||||||
# List of GitHub repositories in 'author/project' format
|
# List of GitHub repositories in 'author/project' format
|
||||||
repositories = [
|
repositories = [
|
||||||
@ -7,7 +8,9 @@ repositories = [
|
|||||||
"xiph/flac",
|
"xiph/flac",
|
||||||
"libunwind/libunwind",
|
"libunwind/libunwind",
|
||||||
"google/benchmark",
|
"google/benchmark",
|
||||||
|
"boostorg/boost",
|
||||||
"openssl/openssl",
|
"openssl/openssl",
|
||||||
|
"libressl/portable",
|
||||||
"jeremy-rifkin/cpptrace",
|
"jeremy-rifkin/cpptrace",
|
||||||
"google/double-conversion",
|
"google/double-conversion",
|
||||||
"fmtlib/fmt",
|
"fmtlib/fmt",
|
||||||
@ -17,31 +20,35 @@ repositories = [
|
|||||||
"google/brotli",
|
"google/brotli",
|
||||||
"facebook/zstd",
|
"facebook/zstd",
|
||||||
"libfuse/libfuse",
|
"libfuse/libfuse",
|
||||||
"microsoft/mimalloc",
|
# "microsoft/mimalloc",
|
||||||
"boostorg/boost",
|
"jemalloc/jemalloc",
|
||||||
|
"tukaani-project/xz",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Function to fetch the latest release information for a repository
|
# Function to fetch the latest release information for a repository
|
||||||
def get_latest_release(repo):
|
def get_latest_release(repo):
|
||||||
url = f"https://api.github.com/repos/{repo}/releases/latest"
|
result = subprocess.run(
|
||||||
response = requests.get(url)
|
["gh", "api", f"repos/{repo}/releases/latest"], capture_output=True, text=True
|
||||||
|
)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if result.returncode == 0:
|
||||||
release = response.json()
|
release = json.loads(result.stdout)
|
||||||
tag_name = release['tag_name']
|
tag_name = release["tag_name"]
|
||||||
release_date = release['published_at']
|
release_date = release["published_at"]
|
||||||
return tag_name, release_date
|
return tag_name, release_date
|
||||||
else:
|
|
||||||
print(f"Failed to fetch data for {repo}")
|
print(f"Failed to fetch data for {repo}")
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|
||||||
# Fetch the latest release information for each repository
|
# Fetch the latest release information for each repository
|
||||||
for repo in repositories:
|
for repo in repositories:
|
||||||
version, release_date = get_latest_release(repo)
|
version, release_date = get_latest_release(repo)
|
||||||
if version and release_date:
|
if version and release_date:
|
||||||
[author, project] = repo.split('/')
|
[author, project] = repo.split("/")
|
||||||
date = release_date.split('T')[0]
|
date = release_date.split("T")[0]
|
||||||
version = version.replace(f"{project}-", "").lstrip('v')
|
version = version.replace(f"{project}-", "").lstrip("v")
|
||||||
project = project.replace('-', '_').upper()
|
project = project.replace("-", "_").upper()
|
||||||
version_var = f"{project}_VERSION={version}"
|
version_var = f"{project}_VERSION={version}"
|
||||||
print(f"{version_var:<40} # {date}")
|
print(f"{version_var:<40} # {date}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user