forked from bernhard-42/cad-viewer-widget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (62 loc) · 2.1 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
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
.PHONY: clean_notebooks bump dist release create-release install upload docs
PYCACHE := $(shell find . -name '__pycache__')
EGGS := $(wildcard *.egg-info)
CURRENT_VERSION := $(shell awk '/current_version/ {print $$3}' setup.cfg)
JQ_RULES := '(.cells[] | select(has("outputs")) | .outputs) = [] \
| (.cells[] | select(has("execution_count")) | .execution_count) = null \
| .metadata = { \
"language_info": {"name":"python", "pygments_lexer": "ipython3"}, \
"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"} \
} \
| .cells[].metadata = {}'
clean_notebooks: ./notebooks/*
@for file in $^ ; do \
echo "$${file}" ; \
jq --indent 1 $(JQ_RULES) "$${file}" > "$${file}_clean"; \
mv "$${file}_clean" "$${file}"; \
python validate_nb.py "$${file}"; \
done
clean: clean_notebooks
@echo "=> Cleaning"
@rm -fr build dist $(EGGS) $(PYCACHE)
@rm -f js/dist/*
prepare: clean
git add .
git status
git commit -m "cleanup before release"
bump:
ifdef part
ifdef version
bumpversion --new-version $(version) $(part) && grep current setup.cfg
else
bumpversion --allow-dirty $(part) && grep current setup.cfg
endif
else
@echo "Provide part=major|minor|patch|release|build and optionally version=x.y.z..."
exit 1
endif
# Dist commands
dist:
@rm -f dist/*
@rm -f js/dist/*
python setup.py sdist bdist_wheel
docs:
@pdoc3 --force --config show_source_code=False --html --output-dir docs cad_viewer_widget
release:
git add .
git status
git diff-index --quiet HEAD || git commit -m "Latest release: $(CURRENT_VERSION)"
git tag -a v$(CURRENT_VERSION) -m "Latest release: $(CURRENT_VERSION)"
create-release:
@github-release release -u bernhard-42 -r cad-viewer-widget -t v$(CURRENT_VERSION) -n cad-viewer-widget-$(CURRENT_VERSION)
@sleep 2
@github-release upload -u bernhard-42 -r cad-viewer-widget -t v$(CURRENT_VERSION) -n cad_viewer_widget-$(CURRENT_VERSION).tar.gz -f dist/cad_viewer_widget-$(CURRENT_VERSION).tar.gz
install: dist
@echo "=> Installing cad-viewer-widget"
@pip install --upgrade .
check_dist:
@twine check dist/*
upload:
@twine upload dist/*
upload_js:
@cd js && npm publish