forked from LLNL/merlin-spellbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (39 loc) · 1.59 KB
/
Makefile
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
VER?=1.0.0
VSTRING=[0-9]\+\.[0-9]\+\.[0-9]\+
PROJ=spellbook
TEST=tests
unit-tests:
python3 -m pytest $(TEST)/
command-line-tests:
python3 $(TEST)/command_line_tests.py
tests: unit-tests command-line-tests
release:
python3 -m build .
# Use like this: make VER=?.?.? verison
version:
# do spellbook/__init__.py
sed -i 's/__version__ = "$(VSTRING)"/__version__ = "$(VER)"/g' $(PROJ)/__init__.py
# do CHANGELOG.md
sed -i 's/## \[Unreleased\]/## [$(VER)]/g' CHANGELOG.md
# do all file headers (works on linux)
find $(PROJ)/ -type f -print0 | xargs -0 sed -i 's/Version: $(VSTRING)/Version: $(VER)/g'
find *.py -type f -print0 | xargs -0 sed -i 's/Version: $(VSTRING)/Version: $(VER)/g'
find $(TEST)/ -type f -print0 | xargs -0 sed -i 's/Version: $(VSTRING)/Version: $(VER)/g'
find Makefile -type f -print0 | xargs -0 sed -i 's/Version: $(VSTRING)/Version: $(VER)/g'
clean:
-find $(PROJ) -name "*.py[cod]" -exec rm -f {} \;
-find $(PROJ) -name "__pycache__" -type d -exec rm -rf {} \;
-rm -rf dist
-rm -rf build
fix-style:
python3 -m isort --line-length 88 $(PROJ)
python3 -m isort --line-length 88 $(TEST)
python3 -m isort --line-length 88 *.py
python3 -m black --line-length 88 --target-version py36 $(PROJ)
python3 -m black --line-length 88 --target-version py36 $(TEST)
python3 -m black --line-length 88 --target-version py36 *.py
check-style:
python3 -m black --check --line-length 88 --target-version py36 $(PROJ)
python3 -m black --check --line-length 88 --target-version py36 $(TEST)
python3 -m pylint $(PROJ) --rcfile=setup.cfg --exit-zero
python3 -m pylint *.py --rcfile=setup.cfg --exit-zero