-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update scripts to allow release (copied from smmap)
- Loading branch information
Showing
2 changed files
with
33 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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,40 +1,12 @@ | ||
PYTHON = python3 | ||
SETUP = $(PYTHON) setup.py | ||
TESTFLAGS = | ||
.PHONY: all clean release force_release | ||
|
||
all:: | ||
all: | ||
@grep -Ee '^[a-z].*:' Makefile | cut -d: -f1 | grep -vF all | ||
|
||
release:: clean | ||
# Check if latest tag is the current head we're releasing | ||
echo "Latest tag = $$(git tag | sort -nr | head -n1)" | ||
echo "HEAD SHA = $$(git rev-parse head)" | ||
echo "Latest tag SHA = $$(git tag | sort -nr | head -n1 | xargs git rev-parse)" | ||
@test "$$(git rev-parse head)" = "$$(git tag | sort -nr | head -n1 | xargs git rev-parse)" | ||
make force_release | ||
clean: | ||
rm -rf build/ dist/ .eggs/ .tox/ | ||
|
||
force_release:: clean | ||
git push --tags | ||
python3 -m build --sdist --wheel | ||
force_release: clean | ||
./build-release.sh | ||
twine upload dist/* | ||
|
||
doc:: | ||
make -C doc/ html | ||
|
||
build:: | ||
$(SETUP) build | ||
$(SETUP) build_ext -i | ||
|
||
build_ext:: | ||
$(SETUP) build_ext -i | ||
|
||
install:: | ||
$(SETUP) install | ||
|
||
clean:: | ||
$(SETUP) clean --all | ||
rm -f *.so | ||
|
||
coverage:: build | ||
PYTHONPATH=. $(PYTHON) -m pytest --cov=gitdb gitdb | ||
|
||
git push --tags origin master |
This file contains 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 |