-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathMakefile
More file actions
135 lines (100 loc) · 3.32 KB
/
Makefile
File metadata and controls
135 lines (100 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
PACKAGE := axonius_api_client
VERSION := $(shell python get_version.py)
PYVER := $(shell cat .python-version)
.PHONY: build docs
help:
@cat Makefile.help
init:
@echo ">>>>>>>> INITIALIZING FOR VERSION: $(VERSION) PYTHON $(PYVER)"
$(MAKE) pip_install_tools
$(MAKE) clean
$(MAKE) pipenv_init_ver
$(MAKE) pip_install_req
$(MAKE) pip_install_lint
$(MAKE) pip_install_dev
$(MAKE) pip_install_docs
$(MAKE) pip_install_build
pip_install_req:
pip install --upgrade --requirement requirements.txt
pip_install_tools:
pip install --upgrade --requirement requirements-pkg.txt
pip_install_dev:
pip install --upgrade --requirement requirements-dev.txt
pip_install_lint:
pip install --upgrade --requirement requirements-lint.txt
pip_install_build:
pip install --upgrade --requirement requirements-build.txt
pip_install_docs:
pip install --upgrade --requirement docs/requirements.txt
pipenv_init:
pipenv install --dev --skip-lock
pipenv_init_ver:
pipenv install --dev --skip-lock --python $(PYVER)
pipenv_clean:
pipenv --rm || true
lint:
pipenv run ruff check --show-source --show-fixes $(PACKAGE) setup.py shell.py
pipenv run black --diff --line-length 100 $(PACKAGE) setup.py shell.py
lint_fix:
pipenv run ruff check --fix $(PACKAGE) setup.py shell.py
pipenv run black --line-length 100 $(PACKAGE) setup.py shell.py
cov_open:
open artifacts/cov_html/index.html
clean_tests:
rm -rf .egg .eggs .tox .pytest_cache artifacts/
docs:
(cd docs && pipenv run make html SPHINXOPTS="-Wna" && cd ..)
docs_dev:
(cd docs && pipenv run make html SPHINXOPTS="-na" && cd ..)
docs_apigen:
pip install sphinx -t /tmp/sphinx-latest --upgrade
rm -rf /tmp/api
PYTHONPATH=/tmp/sphinx-latest /tmp/sphinx-latest/bin/sphinx-apidoc \
-e -P -M -f -T -t docs/_templates \
-o /tmp/api $(PACKAGE) $(PACKAGE)/tests $(PACKAGE)/cli
docs_open:
open docs/_build/html/index.html
docs_coverage:
(cd docs && pipenv run make coverage && cd ..)
cat docs/_build/coverage/python.txt
docs_linkcheck:
(cd docs && pipenv run make linkcheck && cd ..)
cat docs/_build/linkcheck/output.txt
docs_dumprefs:
pipenv run python -m sphinx.ext.intersphinx docs/_build/html/objects.inv
git_check:
@git diff-index --quiet HEAD && echo "*** REPO IS CLEAN" || (echo "!!! REPO IS DIRTY"; false)
@git tag | grep "$(VERSION)" && echo "*** FOUND TAG: $(VERSION)" || (echo "!!! NO TAG FOUND: $(VERSION)"; false)
git_tag:
@git tag "$(VERSION)"
@git push --tags
@echo "*** ADDED TAG: $(VERSION)"
pkg_publish:
# FUTURE: add check that only master branch can publish / git tag
$(MAKE) pkg_build
$(MAKE) git_check
pipenv run twine upload artifacts/dist/*
pkg_build:
$(MAKE) clean_pkg
@echo "*** Building Source and Wheel (universal) distribution"
pipenv run python setup.py sdist bdist_wheel --universal --dist-dir artifacts/dist
@echo "*** Checking package with twine"
pipenv run twine check artifacts/dist/*
pkg_install:
$(MAKE) pkg_build
pip install artifacts/dist/*.whl --upgrade
clean_docs:
rm -rf docs/_build
clean_pkg:
rm -rf dist build artifacts/dist axonius_api_client.egg-info
clean_files:
find . -type d -name "__pycache__" | xargs rm -rf
find . -type f -name ".DS_Store" | xargs rm -f
find . -type f -name "*.pyc" | xargs rm -f
rm -f axonius_api_client.log*
clean:
$(MAKE) clean_files
$(MAKE) clean_pkg
$(MAKE) clean_tests
$(MAKE) clean_docs
$(MAKE) pipenv_clean