File tree Expand file tree Collapse file tree 3 files changed +34
-44
lines changed Expand file tree Collapse file tree 3 files changed +34
-44
lines changed Original file line number Diff line number Diff line change 99* .egg-info
1010.noseids
1111* .sublime-workspace
12+ /env /
Original file line number Diff line number Diff line change 1- .PHONY : build sdist cover test clean-files clean-docs doc all
1+ .PHONY : all clean release force_release
22
33all :
4- $(info Possible targets:)
5- $(info doc)
6- $(info clean-docs)
7- $(info clean-files)
8- $(info clean)
9- $(info test)
10- $(info coverage)
11- $(info build)
12- $(info sdist)
4+ @grep -Ee ' ^[a-z].*:' Makefile | cut -d: -f1 | grep -vF all
135
14- doc :
15- cd doc && make html
6+ clean :
7+ rm -rf build/ dist/ .eggs/ .tox/
168
17- clean-docs :
18- cd doc && make clean
19-
20- clean-files :
21- git clean -fx
22- rm -rf build/ dist/
23-
24- clean : clean-files clean-docs
25-
26- test :
27- pytest
28-
29- coverage :
30- pytest --cov smmap --cov-report xml
31-
32- build :
33- ./setup.py build
34-
35- sdist :
36- ./setup.py sdist
37-
38- release : clean
39- # Check if latest tag is the current head we're releasing
40- echo " Latest tag = $$ (git tag | sort -nr | head -n1)"
41- echo " HEAD SHA = $$ (git rev-parse head)"
42- echo " Latest tag SHA = $$ (git tag | sort -nr | head -n1 | xargs git rev-parse)"
43- @test " $$ (git rev-parse head)" = " $$ (git tag | sort -nr | head -n1 | xargs git rev-parse)"
44- make force_release
45-
46- force_release :: clean
47- git push --tags
48- python3 setup.py sdist bdist_wheel
9+ force_release : clean
10+ ./build-release.sh
4911twine upload dist/*
12+ git push --tags origin main
Original file line number Diff line number Diff line change 1+ #! /bin/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+ function release_with() {
9+ $1 -m build --sdist --wheel
10+ }
11+
12+ if test -n " ${VIRTUAL_ENV:- } " ; then
13+ deps=(build twine) # Install twine along with build, as we need it later.
14+ echo " Virtual environment detected. Adding packages: ${deps[*]} "
15+ pip install --quiet --upgrade " ${deps[@]} "
16+ echo ' Starting the build.'
17+ release_with python
18+ else
19+ function suggest_venv() {
20+ venv_cmd=' python -m venv env && source env/bin/activate'
21+ printf " HELP: To avoid this error, use a virtual-env with '%s' instead.\n" " $venv_cmd "
22+ }
23+ trap suggest_venv ERR # This keeps the original exit (error) code.
24+ echo ' Starting the build.'
25+ release_with python3 # Outside a venv, use python3.
26+ fi
You can’t perform that action at this time.
0 commit comments