Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve when and how Makefile suggests virtual env
The avoids showing the message when the build command was already
run in a virtual environment.

It also keeps the command failing, so the subsequent twine command
is not attempted. (Just adding "|| echo ..." caused the command to
succeed, because "echo ..." itself succeeds except in the rare case
it cannot write to standard output.)
  • Loading branch information
EliahKagan committed Sep 13, 2023
commit cc202cc0fcbbb365e86a8dbc99bb5d6381619671
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ release: clean
force_release: clean
# IF we're in a virtual environment, add build tools
test -z "$$VIRTUAL_ENV" || pip install -U build twine
python3 -m build --sdist --wheel || echo "Use a virtual-env with 'python -m venv env && source env/bin/activate' instead"

# Build the sdist and wheel that will be uploaded to PyPI.
python3 -m build --sdist --wheel || \
test -z "$$VIRTUAL_ENV" && \
echo "Use a virtual-env with 'python -m venv env && source env/bin/activate' instead" && \
false

# Upload to PyPI and push the tag.
twine upload dist/*
git push --tags origin main