-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
121 lines (101 loc) · 4 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
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
PROJECT := pi-clap
AUTHOR := Nikhil John
SRCDIR := ./piclap
DOCSDIR := ./docs
DOCSRCDIR := $(DOCSDIR)/source
DOMAIN := $(PROJECT).nikz.in
DOCTHEME := sphinx_rtd_theme
RELEASE := $(shell cat $(SRCDIR)/__init__.py | grep __version__ | sed -e 's/^.* = '\''//' -e 's/'\''//')
VERSION := $(shell echo $(RELEASE) | sed -e 's/^\([0-9]*\.[0-9]*\).*$$/\1/')
PY_VER := $(shell python3 -V | sed -e 's/^Python //')
PYAUDIO := 0.2.11
help: version
@echo "Please use 'make <target>' where <target> is one of"
@echo " version to display package version"
@echo " setup to install development dependencies"
@echo " remove to remove development dependencies"
@echo " run to run example app"
@echo " clean to clean the build and execution temp files and directories"
@echo " build to build PyPi package"
@echo " publish to upload python package to PyPi server"
@echo " test-publish to upload python package to TestPyPi server"
@echo " install to install python package from PyPi server"
@echo " test-install to install python package from TestPyPi server"
@echo " local-install to install python package from local build"
@echo " docs-clean to clean the documentation directory"
@echo " docs-build to make documentation source directory"
@echo " docs-html to make standalone HTML documentation files for Github Pages"
version:
@echo "\n\t#################################"
@echo "\t#\t\t\t\t#"
@echo "\t#\t $(PROJECT) v$(RELEASE)\t#"
@echo "\t#\t\t\t\t#"
@echo "\t#################################\n"
setup: remove
ifeq (Darwin,$(findstring Darwin, $(shell uname)))
@if ! [[ $(PY_VER) =~ ^3\.[6-8]\.[0-9]+.*$$ ]]; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" && brew install python3 ; fi;
endif
@python3 -m pip install --user -U setuptools wheel
ifeq (Darwin,$(findstring Darwin, $(shell uname)))
@python3 -m pip install --user pyaudio==$(PYAUDIO) || python3 -m pip install --user --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio==$(PYAUDIO)
endif
@python3 -m pip install --user -Ur requirements.txt
remove:
@python3 -m pip uninstall -yr requirements.txt
test:
@pytest
run:
@python3 ./example/advanced.app.py
clean-build:
@rm -rf build/
@rm -rf dist/
@rm -rf *.egg-info
clean: clean-build
@find . -name '*.pyc' -exec rm -f {} +
@find . -name '*.pyo' -exec rm -f {} +
@find . -name '*~' -exec rm -f {} +
@find . -name '.DS_Store' -exec rm -f {} +
@find . -name 'Thumbs.db' -exec rm -f {} +
@find . -name '__pycache__' -exec rm -rf {} +
@find . -name '.pytest_cache' -exec rm -rf {} +
build: clean test
@python3 setup.py sdist bdist_wheel
@twine check dist/*
publish: build
@twine upload dist/*
@make clean
test-publish: build
@twine upload --repository testpypi dist/*
@make clean
install: clean setup
@python3 -m pip install --user pi-clap==$(RELEASE)
test-install: clean setup
@python3 -m pip install --user --index-url https://test.pypi.org/simple/ pi-clap==$(RELEASE)
local-install: build
@python3 -m pip install --user dist/pi_clap-$(RELEASE)-py3-none-any.whl
uninstall:
@python3 -m pip uninstall pi-clap
docs-clean:
@rm -rf $(DOCSDIR)/_* $(DOCSDIR)/*.* $(DOCSDIR)/.buildinfo $(DOCSRCDIR)/_build/*
docs-build: version
@echo "Compiling package documentation"
@sphinx-apidoc -f -F -e -a -l -d 5 -H '$(PROJECT)' -A '$(AUTHOR)' -V '$(VERSION)' -R '$(RELEASE)' -o $(DOCSRCDIR) $(SRCDIR)
@sed -i '' -e 's/path\.insert\(.*\)$$/path.append\('\''..\/..'\''\)/' -e "s/alabaster/$(DOCTHEME)/" $(DOCSRCDIR)/conf.py
docs-html: docs-clean
@cd $(DOCSRCDIR) && make html
@echo 'Moving HTML files to docs directory'
@cp -af $(DOCSRCDIR)/_build/html/. $(DOCSDIR)
@echo 'Configuring docs for Github pages'
@echo '$(DOMAIN)' > $(DOCSDIR)/CNAME
@echo 'Documentation successfully created.'
@touch $(DOCSDIR)/.nojekyll
.PHONY:
help
test
version
setup
remove
clean
build
publish
install