2020-03-07 13:24:38 +00:00
|
|
|
#!/usr/bin/env python3
|
2021-05-21 17:45:43 -04:00
|
|
|
# This file supports 3.6+
|
2020-03-07 13:24:38 +00:00
|
|
|
|
|
|
|
|
import os
|
2020-12-21 19:51:27 +01:00
|
|
|
import shutil
|
2020-03-07 13:24:38 +00:00
|
|
|
import subprocess
|
2020-12-21 19:51:27 +01:00
|
|
|
import sys
|
2021-05-21 17:45:43 -04:00
|
|
|
from pathlib import Path
|
2020-03-07 13:24:38 +00:00
|
|
|
|
2021-05-21 17:45:43 -04:00
|
|
|
DIR = Path(__file__).parent.resolve()
|
|
|
|
|
RESOURCES = DIR.parent / "cibuildwheel/resources"
|
2020-03-07 13:24:38 +00:00
|
|
|
|
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-07 13:24:38 +00:00
|
|
|
|
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"
|
2020-12-21 19:51:27 +01:00
|
|
|
|
2021-05-25 13:43:31 -04:00
|
|
|
os.chdir(DIR.parent)
|
2020-12-21 19:51:27 +01:00
|
|
|
|
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",
|
|
|
|
|
)
|