Files
cibuildwheel/bin/update_dependencies.py
T

41 lines
949 B
Python
Raw Normal View History

#!/usr/bin/env python3
2021-05-21 17:45:43 -04:00
# This file supports 3.6+
import os
import shutil
import subprocess
import sys
2021-05-21 17:45:43 -04:00
from pathlib import Path
2021-05-21 17:45:43 -04:00
DIR = Path(__file__).parent.resolve()
RESOURCES = DIR.parent / "cibuildwheel/resources"
2021-05-21 17:45:43 -04:00
python_version = "".join(str(v) for v in sys.version_info[:2])
env = os.environ.copy()
2020-03-17 20:28:53 +00:00
# CUSTOM_COMPILE_COMMAND is a pip-compile option that tells users how to
# regenerate the constraints files
2021-05-21 17:45:43 -04:00
env["CUSTOM_COMPILE_COMMAND"] = "bin/update_dependencies.py"
2021-05-25 13:43:31 -04:00
os.chdir(DIR.parent)
2021-05-21 17:45:43 -04:00
subprocess.run(
[
"pip-compile",
"--allow-unsafe",
"--upgrade",
2021-05-25 13:43:31 -04:00
"cibuildwheel/resources/constraints.in",
f"--output-file=cibuildwheel/resources/constraints-python{python_version}.txt",
2021-05-21 17:45:43 -04:00
],
check=True,
env=env,
2021-04-30 17:56:34 -04:00
)
2021-04-25 03:45:27 -04:00
2021-05-21 17:45:43 -04:00
# default constraints.txt
if python_version == "39":
shutil.copyfile(
RESOURCES / f"constraints-python{python_version}.txt",
RESOURCES / "constraints.txt",
)