@@ -5,15 +5,15 @@ CURRENT_SIGN_SETTING := $(shell git config commit.gpgSign)
5
5
help :
6
6
@echo " clean-build - remove build artifacts"
7
7
@echo " clean-pyc - remove Python file artifacts"
8
+ @echo " clean - run clean-build and clean-pyc"
9
+ @echo " dist - build package and cat contents of the dist directory"
8
10
@echo " lint - fix linting issues with pre-commit"
9
11
@echo " test - run tests quickly with the default Python"
10
12
@echo " docs - generate docs and open in browser (linux-docs for version on linux)"
11
13
@echo " autobuild-docs - live update docs when changes are saved"
12
- @echo " notes - consume towncrier newsfragments/ and update release notes in docs/"
13
- @echo " release - package and upload a release (does not run notes target)"
14
- @echo " dist - package"
15
-
16
- clean : clean-build clean-pyc
14
+ @echo " package-test - build package and install it in a venv for manual testing"
15
+ @echo " notes - consume towncrier newsfragments and update release notes in docs - requires bump to be set"
16
+ @echo " release - package and upload a release (does not run notes target) - requires bump to be set"
17
17
18
18
clean-build :
19
19
rm -fr build/
@@ -26,6 +26,12 @@ clean-pyc:
26
26
find . -name ' *~' -exec rm -f {} +
27
27
find . -name ' __pycache__' -exec rm -rf {} +
28
28
29
+ clean : clean-build clean-pyc
30
+
31
+ dist : clean
32
+ python -m build
33
+ ls -l dist
34
+
29
35
lint :
30
36
@pre-commit run --all-files --show-diff-on-failure || ( \
31
37
echo " \n\n\n * pre-commit should have fixed the errors above. Running again to make sure everything is good..." \
@@ -35,62 +41,78 @@ lint:
35
41
test :
36
42
python -m pytest tests
37
43
44
+ # docs commands
45
+
46
+ docs : check-docs
47
+ open docs/_build/html/index.html
48
+
49
+ linux-docs : check-docs
50
+ xdg-open docs/_build/html/index.html
51
+
38
52
autobuild-docs :
39
53
sphinx-autobuild --open-browser docs docs/_build/html
40
54
41
- build-docs :
42
- sphinx-apidoc -o docs/ . setup.py " *conftest*"
43
- $(MAKE ) -C docs clean
44
- $(MAKE ) -C docs html
45
- $(MAKE ) -C docs doctest
46
-
47
- build-docs-ci :
48
- $(MAKE ) -C docs latexpdf
49
- $(MAKE ) -C docs epub
55
+ # docs helpers
50
56
51
57
validate-newsfragments :
52
58
python ./newsfragments/validate_files.py
53
59
towncrier build --draft --version preview
54
60
55
61
check-docs : build-docs validate-newsfragments
56
62
63
+ build-docs :
64
+ sphinx-apidoc -o docs/ . setup.py " *conftest*"
65
+ $(MAKE ) -C docs clean
66
+ $(MAKE ) -C docs html
67
+ $(MAKE ) -C docs doctest
68
+
57
69
check-docs-ci : build-docs build-docs-ci validate-newsfragments
58
70
59
- docs : check-docs
60
- open docs/_build/html/index.html
71
+ build-docs-ci :
72
+ $(MAKE ) -C docs latexpdf
73
+ $(MAKE ) -C docs epub
61
74
62
- linux-docs : check-docs
63
- xdg-open docs/_build/html/index.html
75
+ # release commands
64
76
65
- check-bump :
66
- ifndef bump
67
- $(error bump must be set, typically: major, minor, patch, or devnum)
68
- endif
77
+ package-test : clean
78
+ python -m build
79
+ python scripts/release/test_package.py
69
80
70
- notes : check-bump validate-newsfragments
81
+ notes : check-bump
71
82
# Let UPCOMING_VERSION be the version that is used for the current bump
72
- $(eval UPCOMING_VERSION=$(shell bumpversion $( bump ) --dry-run --list | grep new_version= | sed 's/new_version=//g' ) )
83
+ $(eval UPCOMING_VERSION=$(shell bump-my-version show --increment $( bump ) new_version) )
73
84
# Now generate the release notes to have them included in the release commit
74
85
towncrier build --yes --version $(UPCOMING_VERSION )
75
86
# Before we bump the version, make sure that the towncrier-generated docs will build
76
87
make build-docs
77
88
git commit -m " Compile release notes for v$( UPCOMING_VERSION) "
78
89
79
- release : check-bump clean
80
- # require that upstream is configured for ethereum/<REPO_NAME>
81
- @git remote -v
| grep
" upstream[[:space:]][email protected] :ethereum/<REPO_NAME>.git (push)\|upstream[[:space:]]https://github.com/ethereum/<REPO_NAME> (push)"
82
- # verify that docs build correctly
90
+ release : check-bump check-git clean
91
+ # verify that notes command ran correctly
83
92
./newsfragments/validate_files.py is-empty
84
- make build-docs
85
93
CURRENT_SIGN_SETTING=$(git config commit.gpgSign )
86
94
git config commit.gpgSign true
87
- bumpversion $(bump )
88
- git push upstream && git push upstream --tags
95
+ bump-my-version bump $(bump )
89
96
python -m build
90
- twine upload dist/*
91
97
git config commit.gpgSign " $( CURRENT_SIGN_SETTING) "
98
+ git push upstream && git push upstream --tags
99
+ twine upload dist/*
92
100
101
+ # release helpers
93
102
94
- dist : clean
95
- python -m build
96
- ls -l dist
103
+ check-bump :
104
+ ifndef bump
105
+ $(error bump must be set, typically: major, minor, patch, or devnum)
106
+ endif
107
+
108
+ check-git :
109
+ # require that you be on a branch that's linked to upstream/main
110
+ @if ! git status -s -b | head -1 | grep -q " \.\.upstream/main" ; then \
111
+ echo " Error: You must be on a branch that's linked to upstream/main" ; \
112
+ exit 1; \
113
+ fi
114
+ # require that upstream is configured for ethereum/<REPO_NAME>
115
+ @if
! git remote -v
| grep
" upstream[[:space:]][email protected] :ethereum/<REPO_NAME>.git (push)\|upstream[[:space:]]https://github.com/ethereum/<REPO_NAME> (push)" ; then \
116
+ echo " Error: You must have a remote named 'upstream' that points to '<REPO_NAME>'" ; \
117
+ exit 1; \
118
+ fi
0 commit comments