Delete vcpkg_version_finder.py

This commit is contained in:
LIZARD-OFFICIAL-ALT 2024-10-01 12:28:45 +02:00 committed by GitHub
parent b0aa5c6f2e
commit a6647980e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 60 deletions

View File

@ -1,60 +0,0 @@
from pathlib import Path
import json
import sys
if (sys.version_info.major, sys.version_info.minor) < (3, 6):
raise TypeError("at least python 3.6 is required for this script")
if len(sys.argv) > 1:
PKG_NAME = sys.argv[1]
else:
raise TypeError("package name must be passed")
if len(sys.argv) > 2:
VCPKG_PATH = Path(sys.argv[2])
else:
print("no vcpkg path has been passed. Assuming vcpkg root is on the same level as this script file")
VCPKG_PATH = Path(__file__).parent / 'vcpkg'
if len(sys.argv) > 3:
print("the arguments after the second one are ignored")
if not VCPKG_PATH.exists():
raise FileNotFoundError(f"dir does not exist: {VCPKG_PATH}")
VERSIONS_PATH = VCPKG_PATH / 'versions'
if not VERSIONS_PATH.exists():
raise FileNotFoundError(f"dir does not exist: {VERSIONS_PATH}")
PKG_VERSION_PATH = VERSIONS_PATH / (PKG_NAME[0] + '-')
if not PKG_VERSION_PATH.exists():
raise FileNotFoundError(f"dir does not exist: {PKG_VERSION_PATH}")
PKG_VERSION_JSON_PATHNAME = PKG_VERSION_PATH / (PKG_NAME + '.json')
if not PKG_VERSION_JSON_PATHNAME.exists:
raise FileNotFoundError(f"dir does not exist: {PKG_VERSION_JSON_PATHNAME}")
print(f'reading versions from {PKG_VERSION_JSON_PATHNAME}')
with open(PKG_VERSION_JSON_PATHNAME) as f:
pkg_versions_file = json.load(f)
info_list = pkg_versions_file["versions"]
versions_list = []
for info in info_list:
if "version-string" in info:
versions_list.append(info["version-string"])
elif "version" in info:
versions_list.append(info["version"])
elif "version-date" in info:
versions_list.append(info["version-date"])
elif "version-semver" in info:
versions_list.append(info["version-semver"])
else:
raise KeyError(info)
versions_set = sorted(set(versions_list), reverse=True)
for version in versions_set:
print(version)