forked from shengchenyang/AyugeSpiderTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (77 loc) · 2.64 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
.PHONY: start clean build install build_dist test release pytest check
refresh: clean build install
ifeq ($(OS),Windows_NT)
RM = cmd.exe /C del /F /Q
RMDIR = cmd.exe /C rd /S /Q
PATHSEP = \\
PIPINSTALL = cmd.exe /C "FOR %%i in (dist\*.whl) DO python -m pip install --no-index --no-deps %%i"
CLEAN_PYCACHE = for /d /r . %%d in (__pycache__) do @(if exist "%%d" (rd /s /q "%%d"))
CLEAN_PYTESTCACHE = for /d /r . %%d in (.pytest_cache) do @(if exist "%%d" (rd /s /q "%%d"))
CLEAN_MYPYCACHE = for /d /r . %%d in (.mypy_cache) do @(if exist "%%d" (rd /s /q "%%d"))
else
UNAME_S := $(shell uname -s 2>/dev/null || echo "unknown")
ifeq ($(UNAME_S),Linux)
RM = rm -f
RMDIR = rm -rf
PATHSEP = /
PIPINSTALL = pip install dist/*.tar.gz
CLEAN_PYCACHE = find . -type d -name '__pycache__' -print0 | xargs -0 rm -rf
CLEAN_PYTESTCACHE = find . -type d -name '.pytest_cache' -print0 | xargs -0 rm -rf
CLEAN_MYPYCACHE = find . -type d -name '.mypy_cache' -print0 | xargs -0 rm -rf
endif
ifeq ($(UNAME_S),Darwin)
RM = rm -f
RMDIR = rm -rf
PATHSEP = /
PIPINSTALL = pip install dist/*.tar.gz
CLEAN_PYCACHE = find . -type d -name '__pycache__' -print0 | xargs -0 rm -rf
CLEAN_PYTESTCACHE = find . -type d -name '.pytest_cache' -print0 | xargs -0 rm -rf
CLEAN_MYPYCACHE = find . -type d -name '.mypy_cache' -print0 | xargs -0 rm -rf
endif
endif
start:
pip install poetry
poetry install
pre-commit install
build:
poetry build
install:
$(PIPINSTALL)
build_dist:
make clean
python setup.py sdist bdist_wheel
$(PIPINSTALL)
make test
release:
poetry publish
test:
poetry install -E "all"
coverage run -m pytest
coverage combine
coverage report
make clean
pytest:
poetry install
pytest -W ignore::DeprecationWarning
check:
pre-commit run --all-files
path = $(subst /,$(strip $(PATHSEP)),$1)
clean:
-$(CLEAN_PYCACHE)
-$(CLEAN_PYTESTCACHE)
-$(CLEAN_MYPYCACHE)
-$(RMDIR) $(call path, dist)
-$(RMDIR) $(call path, file.log)
-$(RMDIR) $(call path, docs$(PATHSEP)_build)
-$(RMDIR) $(call path, htmlcov)
-$(RM) $(call path, .coverage)
-$(RM) $(call path, .coverage.*)
-$(RM) $(call path, coverage.xml)
-$(RMDIR) $(call path, .tox)
-$(RM) $(call path, tests$(PATHSEP)docs$(PATHSEP)txt$(PATHSEP)run.log)
-$(RM) $(call path, tests$(PATHSEP)docs$(PATHSEP)keys$(PATHSEP)localhost.crt)
-$(RM) $(call path, tests$(PATHSEP)docs$(PATHSEP)keys$(PATHSEP)localhost.key)
-$(RM) $(call path, tests$(PATHSEP)keys$(PATHSEP)localhost.crt)
-$(RM) $(call path, tests$(PATHSEP)keys$(PATHSEP)localhost.key)
poetry install
pip uninstall -y ayugespidertools