File tree 2 files changed +33
-35
lines changed
2 files changed +33
-35
lines changed Original file line number Diff line number Diff line change 1
- PYTHON = python3
2
- SETUP = $(PYTHON ) setup.py
3
- TESTFLAGS =
1
+ .PHONY : all clean release force_release
4
2
5
- all ::
3
+ all :
6
4
@grep -Ee ' ^[a-z].*:' Makefile | cut -d: -f1 | grep -vF all
7
5
8
- release :: clean
9
- # Check if latest tag is the current head we're releasing
10
- echo " Latest tag = $$ (git tag | sort -nr | head -n1)"
11
- echo " HEAD SHA = $$ (git rev-parse head)"
12
- echo " Latest tag SHA = $$ (git tag | sort -nr | head -n1 | xargs git rev-parse)"
13
- @test " $$ (git rev-parse head)" = " $$ (git tag | sort -nr | head -n1 | xargs git rev-parse)"
14
- make force_release
6
+ clean :
7
+ rm -rf build/ dist/ .eggs/ .tox/
15
8
16
- force_release :: clean
17
- git push --tags
18
- python3 -m build --sdist --wheel
9
+ force_release : clean
10
+ ./build-release.sh
19
11
twine upload dist/*
20
-
21
- doc ::
22
- make -C doc/ html
23
-
24
- build ::
25
- $(SETUP ) build
26
- $(SETUP ) build_ext -i
27
-
28
- build_ext ::
29
- $(SETUP ) build_ext -i
30
-
31
- install ::
32
- $(SETUP ) install
33
-
34
- clean ::
35
- $(SETUP ) clean --all
36
- rm -f * .so
37
-
38
- coverage :: build
39
- PYTHONPATH=. $(PYTHON ) -m pytest --cov=gitdb gitdb
40
-
12
+ git push --tags origin master
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