[CI] Build a CPU-only wheel under name xgboost-cpu (#10603)

This commit is contained in:
Philip Hyunsu Cho
2024-07-19 10:51:08 -07:00
committed by GitHub
parent 7ab93f3ce3
commit 326921dbe4
10 changed files with 164 additions and 85 deletions

View File

@@ -2,6 +2,7 @@
tqdm, sh are required to run this script.
"""
import argparse
import os
import shutil
@@ -106,6 +107,15 @@ def make_pysrc_wheel(
if not os.path.exists(dist):
os.mkdir(dist)
# Apply patch to remove NCCL dependency
# Save the original content of pyproject.toml so that we can restore it later
with DirectoryExcursion(ROOT):
with open("python-package/pyproject.toml", "r") as f:
orig_pyproj_lines = f.read()
with open("tests/buildkite/remove_nccl_dep.patch", "r") as f:
patch_lines = f.read()
subprocess.run(["patch", "-p0"], input=patch_lines, text=True)
with DirectoryExcursion(os.path.join(ROOT, "python-package")):
subprocess.check_call(["python", "-m", "build", "--sdist"])
if rc is not None:
@@ -117,6 +127,10 @@ def make_pysrc_wheel(
target = os.path.join(dist, name)
shutil.move(src, target)
with DirectoryExcursion(ROOT):
with open("python-package/pyproject.toml", "w") as f:
print(orig_pyproj_lines, file=f, end="")
def download_py_packages(
branch: str, major: int, minor: int, commit_hash: str, outdir: str