From 8699c7e5da48e6a2ecd9625ac506d4d9f10dae49 Mon Sep 17 00:00:00 2001 From: Joe Cummings Date: Tue, 28 Mar 2023 15:56:01 -0400 Subject: [PATCH] Revert "Simplify torchdata version extraction in packaging script (#2129)" This reverts commit 10d1349d1441ecaaa2bae343d66b74d5ad9a7346. --- packaging/install_torchdata.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packaging/install_torchdata.sh b/packaging/install_torchdata.sh index 5981a00c76..0a9fc79834 100755 --- a/packaging/install_torchdata.sh +++ b/packaging/install_torchdata.sh @@ -1,6 +1,6 @@ #!/bin/bash package_type="$PACKAGE_TYPE" -channel="$CHANNEL" +channel="$CHANNEl" if [ -z "$package_type" ]; then package_type="wheel" fi @@ -33,7 +33,14 @@ $install_cmd torchdata $install_channel if [ "$package_type" = "wheel" ]; then TORCHDATA_VERSION="$(pip show torchdata | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')" else - TORCHDATA_VERSION="$(conda list -fe torchdata | grep torchdata | sed -e 's/torchdata=\(.*\)=py.*/\1/')" + TORCHDATA_VERSION="$(conda search --json 'torchdata[channel=pytorch-'"${channel}"] | \ + python -c "import json, os, re, sys; \ + cuver = 'cpu'; \ + pyver = os.environ.get('PYTHON_VERSION').replace('.', ''); \ + print(re.sub(r'\\+.*$', '', + [x['version'] for x in json.load(sys.stdin)['torchdata'] \ + if 'py' + pyver in x['fn']][-1]))" + )" echo "export CONDA_TORCHDATA_CONSTRAINT='- torchdata==${TORCHDATA_VERSION}'" >> "${BUILD_ENV_FILE}" fi