Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b1c564

Browse files
committed
Extract build from force_release target to script
This moves the conditional build dependency installation logic andbuild logic from the force_release Makefile target to a shellscript build-release.sh, which force_release calls. The code ischanged to clean it up, and also to account for differences betweenhow output is displayed and errors reported in Makefiles and shellscripts. (As in check-version.sh, the .sh suffix does not signifyanything about how the script is to be used: like the other shellscripts in the project, this should be executed, no sourced.)
1 parent6495d84 commit4b1c564

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

‎.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
test/fixtures/*eol=lf
22
init-tests-after-clone.sheol=lf
3-
check-version.sheol=lf
43
Makefileeol=lf
4+
check-version.sheol=lf
5+
build-release.sheol=lf

‎Makefile

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ release: clean
1111
make force_release
1212

1313
force_release: clean
14-
# IF we're in a virtual environment, add build tools
15-
test -z"$$VIRTUAL_ENV"|| pip install -U build twine
16-
17-
# Build the sdist and wheel that will be uploaded to PyPI.
18-
if test -n "$$VIRTUAL_ENV"; then \
19-
python -m build --sdist --wheel; \
20-
else \
21-
python3 -m build --sdist --wheel || \
22-
{ echo "Use a virtual-env with 'python -m venv env && source env/bin/activate' instead" && false; }; \
23-
fi
24-
25-
# Upload to PyPI and push the tag.
14+
./build-release.sh
2615
twine upload dist/*
2716
git push --tags origin main

‎build-release.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script builds a release. If run in a venv, it auto-installs its tools.
4+
# You may want to run "make release" instead of running this script directly.
5+
6+
set -eEu
7+
8+
iftest -n"${VIRTUAL_ENV:-}";then
9+
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+
else
15+
suggest_venv() {
16+
venv_cmd='python -m venv env && source env/bin/activate'
17+
printf"Use a virtual-env with '%s' instead.\n""$venv_cmd"
18+
}
19+
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.
22+
fi

‎check-version.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env bash
22
#
3-
# This script checks if weappear ready to build and publish a new release.
3+
# This script checks if weare in a consistent state to build a new release.
44
# See the release instructions in README.md for the steps to make this pass.
5+
# You may want to run "make release" instead of running this script directly.
56

67
set -eEfuo pipefail
78
trap'printf "%s: Check failed. Stopping.\n" "$0" >&2' ERR

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp