Fix release script for RC [skip ci] (#9505)
This commit is contained in:
parent
74d5056c61
commit
38a3e1b858
@ -98,17 +98,24 @@ def download_wheels(
|
|||||||
return filenames
|
return filenames
|
||||||
|
|
||||||
|
|
||||||
def make_pysrc_wheel(release: str, outdir: str) -> None:
|
def make_pysrc_wheel(
|
||||||
|
release: str, rc: Optional[str], rc_ver: Optional[int], outdir: str
|
||||||
|
) -> None:
|
||||||
"""Make Python source distribution."""
|
"""Make Python source distribution."""
|
||||||
dist = os.path.join(outdir, "dist")
|
dist = os.path.abspath(os.path.normpath(os.path.join(outdir, "dist")))
|
||||||
if not os.path.exists(dist):
|
if not os.path.exists(dist):
|
||||||
os.mkdir(dist)
|
os.mkdir(dist)
|
||||||
|
|
||||||
with DirectoryExcursion(os.path.join(ROOT, "python-package")):
|
with DirectoryExcursion(os.path.join(ROOT, "python-package")):
|
||||||
subprocess.check_call(["python", "-m", "build", "--sdist"])
|
subprocess.check_call(["python", "-m", "build", "--sdist"])
|
||||||
src = os.path.join(DIST, f"xgboost-{release}.tar.gz")
|
if rc is not None:
|
||||||
|
name = f"xgboost-{release}{rc}{rc_ver}.tar.gz"
|
||||||
|
else:
|
||||||
|
name = f"xgboost-{release}.tar.gz"
|
||||||
|
src = os.path.join(DIST, name)
|
||||||
subprocess.check_call(["twine", "check", src])
|
subprocess.check_call(["twine", "check", src])
|
||||||
shutil.move(src, os.path.join(dist, f"xgboost-{release}.tar.gz"))
|
target = os.path.join(dist, name)
|
||||||
|
shutil.move(src, target)
|
||||||
|
|
||||||
|
|
||||||
def download_py_packages(
|
def download_py_packages(
|
||||||
@ -172,7 +179,9 @@ def download_r_packages(
|
|||||||
hashes = []
|
hashes = []
|
||||||
with DirectoryExcursion(os.path.join(outdir, "r-packages")):
|
with DirectoryExcursion(os.path.join(outdir, "r-packages")):
|
||||||
for f in filenames:
|
for f in filenames:
|
||||||
ret = subprocess.run(["sha256sum", os.path.basename(f)], capture_output=True)
|
ret = subprocess.run(
|
||||||
|
["sha256sum", os.path.basename(f)], capture_output=True
|
||||||
|
)
|
||||||
h = ret.stdout.decode().strip()
|
h = ret.stdout.decode().strip()
|
||||||
hashes.append(h)
|
hashes.append(h)
|
||||||
return urls, hashes
|
return urls, hashes
|
||||||
@ -306,7 +315,7 @@ def main(args: argparse.Namespace) -> None:
|
|||||||
hashes.extend(hr)
|
hashes.extend(hr)
|
||||||
|
|
||||||
# Python source wheel
|
# Python source wheel
|
||||||
make_pysrc_wheel(release, args.outdir)
|
make_pysrc_wheel(release, rc, rc_ver, args.outdir)
|
||||||
|
|
||||||
# Python binary wheels
|
# Python binary wheels
|
||||||
download_py_packages(branch, major, minor, commit_hash, args.outdir)
|
download_py_packages(branch, major, minor, commit_hash, args.outdir)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user