Skip to content

Commit 10d1349

Browse files
authored
Simplify torchdata version extraction in packaging script (#2129)
* Simplify torchdata extraction * fix regex
1 parent 22a998e commit 10d1349

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

packaging/install_torchdata.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
package_type="$PACKAGE_TYPE"
3-
channel="$CHANNEl"
3+
channel="$CHANNEL"
44
if [ -z "$package_type" ]; then
55
package_type="wheel"
66
fi
@@ -33,14 +33,7 @@ $install_cmd torchdata $install_channel
3333
if [ "$package_type" = "wheel" ]; then
3434
TORCHDATA_VERSION="$(pip show torchdata | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
3535
else
36-
TORCHDATA_VERSION="$(conda search --json 'torchdata[channel=pytorch-'"${channel}"] | \
37-
python -c "import json, os, re, sys; \
38-
cuver = 'cpu'; \
39-
pyver = os.environ.get('PYTHON_VERSION').replace('.', ''); \
40-
print(re.sub(r'\\+.*$', '',
41-
[x['version'] for x in json.load(sys.stdin)['torchdata'] \
42-
if 'py' + pyver in x['fn']][-1]))"
43-
)"
36+
TORCHDATA_VERSION="$(conda list -fe torchdata | grep torchdata | sed -e 's/torchdata=\(.*\)=py.*/\1/')"
4437
echo "export CONDA_TORCHDATA_CONSTRAINT='- torchdata==${TORCHDATA_VERSION}'" >> "${BUILD_ENV_FILE}"
4538
fi
4639

0 commit comments

Comments
 (0)