Skip to content

Commit 1e0b3f9

Browse files
committed
refinements to build-reelase.sh
- use `echo` where feasible to avoid explicit newlines - use `function` syntax out of habit - deduplicate release invocation - make `venv` based invocation less verbose - make help-text in non-venv more prominent
1 parent 5919f8d commit 1e0b3f9

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

build-release.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@
55

66
set -eEu
77

8+
function release_with() {
9+
$1 -m build --sdist --wheel
10+
}
11+
812
if test -n "${VIRTUAL_ENV:-}"; then
913
deps=(build twine) # Install twine along with build, as we need it later.
10-
printf 'Virtual environment detected. Adding packages: %s\n' "${deps[*]}"
11-
pip install -U "${deps[@]}"
12-
printf 'Starting the build.\n'
13-
python -m build --sdist --wheel
14+
echo "Virtual environment detected. Adding packages: ${deps[*]}"
15+
pip install --quiet --upgrade "${deps[@]}"
16+
echo 'Starting the build.'
17+
release_with python
1418
else
15-
suggest_venv() {
19+
function suggest_venv() {
1620
venv_cmd='python -m venv env && source env/bin/activate'
17-
printf "Use a virtual-env with '%s' instead.\n" "$venv_cmd"
21+
printf "HELP: To avoid this error, use a virtual-env with '%s' instead.\n" "$venv_cmd"
1822
}
1923
trap suggest_venv ERR # This keeps the original exit (error) code.
20-
printf 'Starting the build.\n'
21-
python3 -m build --sdist --wheel # Outside a venv, use python3.
24+
echo 'Starting the build.'
25+
release_with python3 # Outside a venv, use python3.
2226
fi

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy