mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-05 17:02:32 -05:00
Bump dependencies (#6312)
This commit is contained in:
@@ -1,19 +1,26 @@
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
EXCLUDE_STEM_RE = re.compile(r".*-3\.(?!8-)(\d+)-extra-(doc|style)")
|
||||
GITHUB_OUTPUT = os.environ["GITHUB_OUTPUT"]
|
||||
REQUIREMENTS_FOLDER = Path(__file__).parents[3].absolute() / "requirements"
|
||||
os.chdir(REQUIREMENTS_FOLDER)
|
||||
|
||||
|
||||
def pip_compile(name: str) -> None:
|
||||
def pip_compile(version: str, name: str) -> None:
|
||||
stem = f"{sys.platform}-{version}-{name}"
|
||||
if EXCLUDE_STEM_RE.fullmatch(stem):
|
||||
return
|
||||
|
||||
executable = ("py", f"-{version}") if sys.platform == "win32" else (f"python{version}",)
|
||||
subprocess.check_call(
|
||||
(
|
||||
sys.executable,
|
||||
*executable,
|
||||
"-m",
|
||||
"piptools",
|
||||
"compile",
|
||||
@@ -22,15 +29,17 @@ def pip_compile(name: str) -> None:
|
||||
"--verbose",
|
||||
f"{name}.in",
|
||||
"--output-file",
|
||||
f"{sys.platform}-{name}.txt",
|
||||
f"{stem}.txt",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
pip_compile("base")
|
||||
shutil.copyfile(f"{sys.platform}-base.txt", "base.txt")
|
||||
for file in REQUIREMENTS_FOLDER.glob("extra-*.in"):
|
||||
pip_compile(file.stem)
|
||||
for minor in range(8, 11 + 1):
|
||||
version = f"3.{minor}"
|
||||
pip_compile(version, "base")
|
||||
shutil.copyfile(f"{sys.platform}-{version}-base.txt", "base.txt")
|
||||
for file in REQUIREMENTS_FOLDER.glob("extra-*.in"):
|
||||
pip_compile(version, file.stem)
|
||||
|
||||
with open(GITHUB_OUTPUT, "a", encoding="utf-8") as fp:
|
||||
fp.write(f"sys_platform={sys.platform}\n")
|
||||
|
||||
Reference in New Issue
Block a user