-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (46 loc) · 1.18 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
.PHONY: test build clean check
PY2 = python
PY3 = ./venv/bin/python
PY = $(PY2)
TWINE = twine
TR = tr
RM = rm
SED = sed
FIND = find
GREP = grep
XARGS = xargs
PKG_NAME = tispoon
METADATA_FILE = $(PKG_NAME)/__about__.py
PKG_VERSION = $(shell \
$(SED) -n -E "s/__version__ = [\"']([^\"']+)[\"']/\1/p" $(METADATA_FILE))
DIST_DIR = dist
DIST_FILES = $(wildcard $(DIST_DIR)/$(PKG_NAME)-$(PKG_VERSION)*)
TEST_DIR = tests
all: clean build
build: py2dist py3dist
py2dist:
$(PY2) setup.py sdist bdist_wheel
py3dist:
$(PY3) setup.py sdist bdist_wheel
test: py2test py3test
py2test:
$(PY) -m pytest -v -s --cov-config=.coveragerc \
--cov-report html --cov-report term \
--cov=$(PKG_NAME) $(TEST_DIR)
py3test:
$(PY3) -m pytest -v -s --cov-append --cov-config=.coveragerc \
--cov-report html --cov-report term \
--cov=$(PKG_NAME) $(TEST_DIR)
check:
$(TWINE) check $(DIST_DIR)/$(PKG_NAME)-$(PKG_VERSION)*
publish: all check
$(TWINE) upload $(DIST_FILES)
pkg_version:
@echo $(PKG_VERSION)
clean:
$(GREP) '/$$' .gitignore \
| $(XARGS) -I{} echo "\\! -path '*/{}*'" \
| $(TR) $$'\n' ' ' | $(XARGS) $(FIND) . -name '*.pyc' \
| $(XARGS) -n1 $(RM)
$(PY) setup.py clean
$(RM) -rf build/