-
Notifications
You must be signed in to change notification settings - Fork 59
/
Makefile
77 lines (61 loc) · 1.82 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
VERSION = 9.0.0
.PHONY: all
all:
@echo build: Builds the python source dist package
@echo install: Installs python source dist package
@echo clean: Removes any generated files
@echo rst: uses pandoc to generate the README.rst file from README.md
@echo test: Runs the unit tests
.PHONY: clean-temp-files
clean-temp-files:
rm -f *.pyc
rm -f */*.pyc
rm -f -rf __pycache__
rm -f -rf */__pycache__
rm -f -rf py_cpuinfo.egg-info
rm -f -rf dist
rm -f -rf build
.PHONY: clean-dist-files
clean-dist-files:
rm -f -rf py-cpuinfo-$(VERSION)
rm -f -rf py-cpuinfo-$(VERSION).tar.gz
rm -f -rf py-cpuinfo-$(VERSION).zip
rm -f -rf py_cpuinfo-$(VERSION)-py3-none-any.whl
.PHONY: clean
clean: clean-temp-files clean-dist-files
.PHONY: _actual_build
_actual_build:
python3 setup.py sdist --formats=gztar,zip
python3 setup.py bdist_wheel
build: clean _actual_build move_built
$(MAKE) clean-temp-files
.PHONY: move_built
move_built:
mv dist/py-cpuinfo-$(VERSION).tar.gz py-cpuinfo-$(VERSION).tar.gz
mv dist/py-cpuinfo-$(VERSION).zip py-cpuinfo-$(VERSION).zip
mv dist/py_cpuinfo-$(VERSION)-py3-none-any.whl py_cpuinfo-$(VERSION)-py3-none-any.whl
.PHONY: release
release:
# Create release
git commit -a -m "Release $(VERSION)"
git push
# Create and push tag
git tag v$(VERSION) -m "Release $(VERSION)"
git push --tags
.PHONY: upload
upload: clean _actual_build
twine upload dist/py-cpuinfo-$(VERSION).tar.gz
twine upload dist/py_cpuinfo-$(VERSION)-py3-none-any.whl
install: remove
tar xzf py-cpuinfo-$(VERSION).tar.gz
cd py-cpuinfo-$(VERSION)/ && python3 setup.py install
rm -f -rf py-cpuinfo-$(VERSION)
@echo now try "from cpuinfo import get_cpu_info"
@echo "get_cpu_info()"
remove:
rm -f /usr/local/bin/cpuinfo
test:
python3 setup.py test
rst:
rm -f -rf README.rst
pandoc --from=markdown --to=rst --output=README.rst README.md