Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork938
Fix up checks in Makefile and make them portable#1661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
18 commits Select commitHold shift + click to select a range
6fb2318
Reference HEAD in Makefile (more portable than head)
EliahKagan335d03b
Have Makefile use git tag to sort the tags
EliahKaganb1c61d9
Make "git tag" sort our SemVer-ish tags correctly
EliahKagancc202cc
Improve when and how Makefile suggests virtual env
EliahKaganb54c346
Use "python" in the virtual env, "python3" outside
EliahKaganae9405a
LF line endings for scripts that may need them
EliahKaganf5da163
Have "make release" check other release preconditions
EliahKagan5cf7f97
Fix non-venv branch always failing
EliahKagan6495d84
Extract checks from release target to script
EliahKagan4b1c564
Extract build from force_release target to script
EliahKagan729372f
Prevent buggy interaction between MinGW and WSL
EliahKaganba84db4
Fix message wording that was opposite of intended
EliahKagande40e68
Ignore some other virtual environment directories
EliahKagan693d041
make `.gitattributes` file more generic
Byron962f747
submodules don't contribute to the release; ignore their changes
Byrond18d90a
Use 'echo' where possible to avoid explicit newlines
Byron5919f8d
Be explicit on how to interpret the data table
Byron1e0b3f9
refinements to `build-reelase.sh`
ByronFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
3 changes: 2 additions & 1 deletion.gitattributes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
test/fixtures/*eol=lf | ||
*.sheol=lf | ||
/Makefileeol=lf |
2 changes: 2 additions & 0 deletions.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
*.py[co] | ||
*.swp | ||
*~ | ||
.env/ | ||
env/ | ||
.venv/ | ||
venv/ | ||
/*.egg-info | ||
10 changes: 2 additions & 8 deletionsMakefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletionsbuild-release.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
# | ||
# This script builds a release. If run in a venv, it auto-installs its tools. | ||
# You may want to run "make release" instead of running this script directly. | ||
set -eEu | ||
function release_with() { | ||
$1 -m build --sdist --wheel | ||
} | ||
if test -n "${VIRTUAL_ENV:-}"; then | ||
deps=(build twine) # Install twine along with build, as we need it later. | ||
echo "Virtual environment detected. Adding packages: ${deps[*]}" | ||
pip install --quiet --upgrade "${deps[@]}" | ||
echo 'Starting the build.' | ||
release_with python | ||
else | ||
function suggest_venv() { | ||
venv_cmd='python -m venv env && source env/bin/activate' | ||
printf "HELP: To avoid this error, use a virtual-env with '%s' instead.\n" "$venv_cmd" | ||
} | ||
trap suggest_venv ERR # This keeps the original exit (error) code. | ||
echo 'Starting the build.' | ||
release_with python3 # Outside a venv, use python3. | ||
fi |
46 changes: 46 additions & 0 deletionscheck-version.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# | ||
# This script checks if we are in a consistent state to build a new release. | ||
# See the release instructions in README.md for the steps to make this pass. | ||
# You may want to run "make release" instead of running this script directly. | ||
set -eEfuo pipefail | ||
trap 'echo "$0: Check failed. Stopping." >&2' ERR | ||
readonly version_path='VERSION' | ||
readonly changes_path='doc/source/changes.rst' | ||
echo 'Checking current directory.' | ||
test "$(cd -- "$(dirname -- "$0")" && pwd)" = "$(pwd)" # Ugly, but portable. | ||
echo "Checking that $version_path and $changes_path exist and have no uncommitted changes." | ||
test -f "$version_path" | ||
test -f "$changes_path" | ||
git status -s -- "$version_path" "$changes_path" | ||
test -z "$(git status -s -- "$version_path" "$changes_path")" | ||
# This section can be commented out, if absolutely necessary. | ||
echo 'Checking that ALL changes are committed.' | ||
git status -s --ignore-submodules | ||
test -z "$(git status -s --ignore-submodules)" | ||
version_version="$(cat "$version_path")" | ||
changes_version="$(awk '/^[0-9]/ {print $0; exit}' "$changes_path")" | ||
config_opts="$(printf ' -c versionsort.suffix=-%s' alpha beta pre rc RC)" | ||
latest_tag="$(git $config_opts tag -l '[0-9]*' --sort=-v:refname | head -n1)" | ||
head_sha="$(git rev-parse HEAD)" | ||
latest_tag_sha="$(git rev-parse "$latest_tag")" | ||
# Display a table of all the current version, tag, and HEAD commit information. | ||
echo $'\nThe VERSION must be the same in all locations, and so must the HEAD and tag SHA' | ||
printf '%-14s = %s\n' 'VERSION file' "$version_version" \ | ||
'changes.rst' "$changes_version" \ | ||
'Latest tag' "$latest_tag" \ | ||
'HEAD SHA' "$head_sha" \ | ||
'Latest tag SHA' "$latest_tag_sha" | ||
# Check that the latest tag and current version match the HEAD we're releasing. | ||
test "$version_version" = "$changes_version" | ||
test "$latest_tag" = "$version_version" | ||
test "$head_sha" = "$latest_tag_sha" | ||
echo 'OK, everything looks good.' |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.