adutra commented on code in PR #1220:
URL: https://github.com/apache/polaris/pull/1220#discussion_r2005064843


##########
polaris:
##########
@@ -17,29 +17,24 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
 
-if [ ! -d ${SCRIPT_DIR}/polaris-venv ]; then
+set -e
+
+dir=${0%/*}
+
+if [ ! -d "${dir}"/polaris-venv ]; then
   echo "Performing first-time setup for the Python client..."
-  rm -f ${SCRIPT_DIR}/poetry.lock
-  python3 -m venv ${SCRIPT_DIR}/polaris-venv
-  . ${SCRIPT_DIR}/polaris-venv/bin/activate
+  rm -f "${dir}"/poetry.lock
+  python3 -m venv "${dir}"/polaris-venv
+  . "${dir}"/polaris-venv/bin/activate
   pip install -r regtests/requirements.txt
 
-  cp ${SCRIPT_DIR}/client/python/pyproject.toml ${SCRIPT_DIR}
-  pushd $SCRIPT_DIR && poetry install ; popd
+  cp "${dir}"/client/python/pyproject.toml "${dir}"
+  pushd "$dir" && poetry install ; popd
 
   deactivate
   echo "First time setup complete."
 fi
 
-pushd $SCRIPT_DIR > /dev/null
-PYTHONPATH=client/python SCRIPT_DIR="$SCRIPT_DIR" 
${SCRIPT_DIR}/polaris-venv/bin/python3 client/python/cli/polaris_cli.py "$@"
-status=$?
-popd > /dev/null
-
-if [ $status -ne 0 ]; then
-  exit 1
-fi
-
-exit 0
+cd "$dir"
+PYTHONPATH=client/python SCRIPT_DIR="$dir" "${dir}"/polaris-venv/bin/python3 
client/python/cli/polaris_cli.py "$@"

Review Comment:
   It seems that using the `env` command to modify the environment is more 
portable:
   
   ```suggestion
   env PYTHONPATH=client/python SCRIPT_DIR="$dir" 
"${dir}"/polaris-venv/bin/python3 client/python/cli/polaris_cli.py "$@"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to