Skip to content

Commit 62d1214

Browse files
jcfrthewtex
authored andcommitted
*-build-*-wheels.sh: Improve syntax
1 parent 6b0505e commit 62d1214

File tree

5 files changed

+49
-32
lines changed

5 files changed

+49
-32
lines changed

scripts/internal/manylinux-build-module-wheels.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#!/usr/bin/env bash
22

3+
# -----------------------------------------------------------------------
4+
# These variables are set in common script:
5+
#
6+
ARCH=""
7+
PYBINARIES=""
8+
PYTHON_LIBRARY=""
9+
310
script_dir=$(cd $(dirname $0) || exit 1; pwd)
411
source "${script_dir}/manylinux-build-common.sh"
5-
6-
# -----------------------------------------------------------------------
7-
# ARCH, PYBINARIES, PYTHON_LIBRARY variables are set in common script
812
# -----------------------------------------------------------------------
913

1014
# Compile wheels re-using standalone project and archive cache

scripts/internal/manylinux-build-wheels.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#!/usr/bin/env bash
22

3+
# -----------------------------------------------------------------------
4+
# These variables are set in common script:
5+
#
6+
ARCH=""
7+
PYBINARIES=""
8+
PYTHON_LIBRARY=""
9+
310
script_dir=$(cd $(dirname $0) || exit 1; pwd)
411
source "${script_dir}/manylinux-build-common.sh"
5-
6-
# -----------------------------------------------------------------------
7-
# ARCH, PYBINARIES variables are set in common script
812
# -----------------------------------------------------------------------
913

1014
# Build standalone project and populate archive cache
@@ -114,9 +118,9 @@ for PYBIN in "${PYBINARIES[@]}"; do
114118
fi
115119

116120
# Remove unnecessary files for building against ITK
117-
find $build_path -name '*.cpp' -delete -o -name '*.xml' -delete
118-
rm -rf $build_path/Wrapping/Generators/castxml*
119-
find $build_path -name '*.o' -delete
121+
find ${build_path} -name '*.cpp' -delete -o -name '*.xml' -delete
122+
rm -rf ${build_path}/Wrapping/Generators/castxml*
123+
find ${build_path} -name '*.o' -delete
120124

121125
done
122126

scripts/internal/shellcheck-run.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ for f in $(find . -type f -not -iwholename '*.git*' | sort -u); do
2020
if file "$f" | grep --quiet -e shell -e bash; then
2121
shellcheck \
2222
-e SC1090 \
23-
-e SC2006 \
2423
-e SC2046 \
2524
-e SC2086 \
26-
-e SC2153 \
2725
-e SC2155 \
2826
"$f" \
2927
&& echo "[OK]: successfully linted $f" || echo "[FAILED]: found issues linting $f"

scripts/macpython-build-module-wheels.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@
88
#
99
# scripts/macpython-build-module-wheels.sh 2.7 3.5
1010

11+
# -----------------------------------------------------------------------
12+
# These variables are set in common script:
13+
#
14+
MACPYTHON_PY_PREFIX=""
15+
# PYBINARIES="" # unused
16+
PYTHON_LIBRARY=""
17+
SCRIPT_DIR=""
18+
VENVS=()
19+
1120
script_dir=$(cd $(dirname $0) || exit 1; pwd)
1221
source "${script_dir}/macpython-build-common.sh"
13-
14-
# -----------------------------------------------------------------------
15-
# SCRIPT_DIR, VENVS, PYTHON_LIBRARY variables are set in common script
1622
# -----------------------------------------------------------------------
1723

1824
VENV="${VENVS[0]}"

scripts/macpython-build-wheels.sh

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77
#
88
# scripts/macpython-build-wheels.sh 2.7 3.5
99

10+
# -----------------------------------------------------------------------
11+
# These variables are set in common script:
12+
#
13+
MACPYTHON_PY_PREFIX=""
14+
PYBINARIES=""
15+
PYTHON_LIBRARY=""
16+
SCRIPT_DIR=""
17+
1018
script_dir=$(cd $(dirname $0) || exit 1; pwd)
1119
source "${script_dir}/macpython-build-common.sh"
12-
13-
# -----------------------------------------------------------------------
14-
# SCRIPT_DIR, PYBINARIES variables are set in common script
1520
# -----------------------------------------------------------------------
1621

1722
# Remove previous virtualenv's
@@ -26,28 +31,28 @@ for PYBIN in "${PYBINARIES[@]}"; do
2631
py_mm=$(basename ${PYBIN})
2732
VENV=${SCRIPT_DIR}/../venvs/${py_mm}
2833
VIRTUALENV_EXECUTABLE=${PYBIN}/bin/virtualenv
29-
${VIRTUALENV_EXECUTABLE} $VENV
34+
${VIRTUALENV_EXECUTABLE} ${VENV}
3035
VENVS+=(${VENV})
3136
done
3237

3338
VENV="${VENVS[0]}"
3439
PYTHON_EXECUTABLE=${VENV}/bin/python
35-
$PYTHON_EXECUTABLE -m pip install --no-cache cmake
40+
${PYTHON_EXECUTABLE} -m pip install --no-cache cmake
3641
CMAKE_EXECUTABLE=${VENV}/bin/cmake
37-
$PYTHON_EXECUTABLE -m pip install --no-cache ninja
42+
${PYTHON_EXECUTABLE} -m pip install --no-cache ninja
3843
NINJA_EXECUTABLE=${VENV}/bin/ninja
39-
$PYTHON_EXECUTABLE -m pip install --no-cache delocate
44+
${PYTHON_EXECUTABLE} -m pip install --no-cache delocate
4045
DELOCATE_LISTDEPS=${VENV}/bin/delocate-listdeps
4146
DELOCATE_WHEEL=${VENV}/bin/delocate-wheel
4247

4348
# Build standalone project and populate archive cache
4449
mkdir -p standalone-build
4550
pushd standalone-build > /dev/null 2>&1
46-
$CMAKE_EXECUTABLE -DITKPythonPackage_BUILD_PYTHON:PATH=0 \
51+
${CMAKE_EXECUTABLE} -DITKPythonPackage_BUILD_PYTHON:PATH=0 \
4752
-G Ninja \
4853
-DCMAKE_MAKE_PROGRAM:FILEPATH=${NINJA_EXECUTABLE} \
4954
${SCRIPT_DIR}/../
50-
$NINJA_EXECUTABLE
55+
${NINJA_EXECUTABLE}
5156
popd > /dev/null 2>&1
5257

5358
SINGLE_WHEEL=0
@@ -64,7 +69,7 @@ for VENV in "${VENVS[@]}"; do
6469
echo "PYTHON_LIBRARY:${PYTHON_LIBRARY}"
6570

6671
# Install dependencies
67-
$PYTHON_EXECUTABLE -m pip install -r ${SCRIPT_DIR}/../requirements-dev.txt
72+
${PYTHON_EXECUTABLE} -m pip install -r ${SCRIPT_DIR}/../requirements-dev.txt
6873

6974
build_type="MinSizeRel"
7075
plat_name="macosx-10.6-x86_64"
@@ -85,7 +90,7 @@ for VENV in "${VENVS[@]}"; do
8590
# Configure setup.py
8691
${PYTHON_EXECUTABLE} ${SETUP_PY_CONFIGURE} "itk"
8792
# Generate wheel
88-
$PYTHON_EXECUTABLE setup.py bdist_wheel --build-type ${build_type} --plat-name ${plat_name} -G Ninja -- \
93+
${PYTHON_EXECUTABLE} setup.py bdist_wheel --build-type ${build_type} --plat-name ${plat_name} -G Ninja -- \
8994
-DCMAKE_MAKE_PROGRAM:FILEPATH=${NINJA_EXECUTABLE} \
9095
-DITK_SOURCE_DIR:PATH= ${source_path} \
9196
-DITK_BINARY_DIR:PATH=${build_path} \
@@ -95,7 +100,7 @@ for VENV in "${VENVS[@]}"; do
95100
-DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR} \
96101
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
97102
# Cleanup
98-
$PYTHON_EXECUTABLE setup.py clean
103+
${PYTHON_EXECUTABLE} setup.py clean
99104

100105
else
101106

@@ -146,19 +151,19 @@ for VENV in "${VENVS[@]}"; do
146151
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY} \
147152
|| exit 1
148153
# Cleanup
149-
$PYTHON_EXECUTABLE setup.py clean
154+
${PYTHON_EXECUTABLE} setup.py clean
150155
done
151156

152157
fi
153158

154159
# Remove unnecessary files for building against ITK
155-
find $build_path -name '*.cpp' -delete -o -name '*.xml' -delete
156-
rm -rf $build_path/Wrapping/Generators/castxml*
157-
find $build_path -name '*.o' -delete
160+
find ${build_path} -name '*.cpp' -delete -o -name '*.xml' -delete
161+
rm -rf ${build_path}/Wrapping/Generators/castxml*
162+
find ${build_path} -name '*.o' -delete
158163
done
159164

160-
$DELOCATE_LISTDEPS ${SCRIPT_DIR}/../dist/*.whl # lists library dependencies
161-
$DELOCATE_WHEEL ${SCRIPT_DIR}/../dist/*.whl # copies library dependencies into wheel
165+
${DELOCATE_LISTDEPS} ${SCRIPT_DIR}/../dist/*.whl # lists library dependencies
166+
${DELOCATE_WHEEL} ${SCRIPT_DIR}/../dist/*.whl # copies library dependencies into wheel
162167

163168
# Install packages and test
164169
for VENV in "${VENVS[@]}"; do

0 commit comments

Comments
 (0)