Skip to content

Commit f151df6

Browse files
committed
use script to update SHA instead of patch
1 parent 38b5295 commit f151df6

File tree

5 files changed

+38
-27
lines changed

5 files changed

+38
-27
lines changed

recipe/build-core.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ echo %CONDA_PREFIX%
2727
python -c "import os; print('\n'.join(os.environ['PATH'].split(';')))"
2828
echo ----------
2929

30+
echo ========================================
31+
echo Fix up the sha in python/ray/_version.py
32+
echo ========================================
33+
python3 %RECIPE_DIR%/fixup_sha.py python/ray/_version.py %RAY_VER%
34+
35+
3036
echo ==========================================================
3137
echo calling pip to install
3238
echo ==========================================================

recipe/build-core.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ echo '---------------- .bazelrc --------------------------'
4949
cat .bazelrc
5050
echo '----------------------------------------------------'
5151

52+
echo ========================================
53+
echo Fix up the sha in python/ray/_version.py
54+
echo ========================================
55+
python3 ${RECIPE_DIR}/fixup_sha.py python/ray/_version.py ${RAY_VER}
56+
5257
cd python/
5358
export SKIP_THIRDPARTY_INSTALL_CONDA_FORGE=1
5459

recipe/fixup_sha.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Call like python3 __file__ python/ray/_version.py 2.49.2
2+
3+
import json;
4+
import os
5+
import sys
6+
from urllib.request import urlopen;
7+
8+
versionpy = sys.argv[1]
9+
ver = sys.argv[2]
10+
11+
assert os.path.exists(versionpy)
12+
13+
content = urlopen(f'https://api.github.com/repos/ray-project/ray/git/ref/tags/ray-{ver}').read()
14+
sha = json.loads(content)['object']['sha']
15+
with open(versionpy, 'r') as fid:
16+
txt = fid.read()
17+
txt = txt.replace("{{RAY_COMMIT_SHA}}", sha)
18+
assert f'version = "{ver}"' in txt
19+
assert f'commit = "{sha}"' in txt
20+
with open(versionpy, 'w') as fid:
21+
fid.write(txt)

recipe/patches/0004-update-commit-sha.patch

Lines changed: 0 additions & 23 deletions
This file was deleted.

recipe/recipe.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ source:
1515
- patches/0001-Disable-making-entry-scripts.patch
1616
- patches/0002-Ignore-warnings-in-event.cc-and-logging.cc.patch
1717
- patches/0003-Newer-hermetic-python.patch
18-
# This needs modification for each release
19-
- patches/0004-update-commit-sha.patch
2018
# See https://github.com/conda-forge/ray-packages-feedstock/issues/136
2119
# Keep in sync with current or active migration of libgrpc to avoid
2220
# ABI breakage
@@ -35,7 +33,8 @@ source:
3533
- patches/0012-No-path-isolation.patch
3634

3735
build:
38-
number: 1
36+
number: 2
37+
3938

4039
outputs:
4140
- package:
@@ -65,7 +64,10 @@ outputs:
6564
- package:
6665
name: ray-core
6766
build:
68-
script: build-core
67+
script:
68+
file: build-core
69+
env:
70+
RAY_VER: ${{ version }}
6971
python:
7072
entry_points:
7173
- ray = ray.scripts.scripts:main

0 commit comments

Comments
 (0)