From a914e33e9f48a77356006cd54e538d9d36ba8629 Mon Sep 17 00:00:00 2001 From: slycordinator <68940237+slycordinator@users.noreply.github.com> Date: Thu, 23 Feb 2023 16:13:34 +0900 Subject: [PATCH] Fixes according to output from shellcheck * Added "!#" to top of files that didn't have it. * Added quotes around variables/commands as recommended * Changed some to be /bin/sh instead of /bin/bash for portability * removed -o pipefail, especiallly because the scripts seem to not have any piped commands, but also due to it being a bashism --- build.sh | 9 +++++---- lint.sh | 1 + setup.sh | 14 +++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/build.sh b/build.sh index df1f00f7..71e1cdec 100755 --- a/build.sh +++ b/build.sh @@ -1,15 +1,16 @@ +#!/bin/sh # XXX: TODO: we should make this include -e once tests pass -set -xuo pipefail +set -xu DOCKER_IMAGE=jmadler/python-future-builder # XXX: TODO: Perhaps this version shouldn't be hardcoded version=0.18.3 -docker build . -t $DOCKER_IMAGE -docker push $DOCKER_IMAGE:latest +docker build . -t "$DOCKER_IMAGE" +docker push "$DOCKER_IMAGE:latest" for i in py26 py27 py33 py34 py35 py36 py37 py38 py39; do - docker run -ti -v $(realpath dist):/root/python-future/dist $DOCKER_IMAGE /root/python-future/setup.sh $version $(basename $i) + docker run -ti -v "$(realpath dist)":/root/python-future/dist "$DOCKER_IMAGE" /root/python-future/setup.sh "$version" "$i" done python setup.py sdist diff --git a/lint.sh b/lint.sh index 667b258f..b3c41cd4 100755 --- a/lint.sh +++ b/lint.sh @@ -1,3 +1,4 @@ +#!/bin/sh # TODO: Run under Python 2.7 and 3.7 flake8 . --count --exit-zero --select=E901,E999,F821,F822,F823 --show-source --statistics || true flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics || true diff --git a/setup.sh b/setup.sh index 8e8dc150..767cbd55 100755 --- a/setup.sh +++ b/setup.sh @@ -1,20 +1,20 @@ -#!/bin/bash +#!/bin/sh -set -exo pipefail +set -ex version=$1 pytag=$2 -if [ $pytag = 'py33' ]; then +if [ "$pytag" = 'py33' ]; then pip3 install virtualenv==16.2.0 fi -source /root/$pytag/bin/activate +. /root/"$pytag"/bin/activate -if [ $pytag = 'py26' ]; then +if [ "$pytag" = 'py26' ]; then pip install importlib fi pip install pytest unittest2 -python setup.py bdist_wheel --python-tag=$pytag -pip install dist/future-$version-$pytag-none-any.whl +python setup.py bdist_wheel --python-tag="$pytag" +pip install "dist/future-$version-$pytag-none-any.whl" pytest tests/