forked from MrS0m30n3/youtube-dl-gui
-
-
Notifications
You must be signed in to change notification settings - Fork 117
/
Makefile
109 lines (84 loc) · 2.85 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
SHELL = bash
# System python interpreter. Used only to create virtual environment
PY = python3
VENVDIR = ./venv
BIN := $(VENVDIR)/bin
RM = rm -f
RMR := $(RM)r
ACTIVATE=source $(BIN)/activate
all: format lint test-cov
venv:
@if [ -d $(VENVDIR) ] ; then \
echo "venv already exists."; \
echo "To recreate it, remove it first with \`make clean-venv'."; \
else \
$(MAKE) ensure-venv; \
fi
.PHONY: ensure-venv
ensure-venv:
@if [ ! -d $(VENVDIR) ] ; then \
$(PY) -m venv $(VENVDIR); \
$(BIN)/$(PY) -m pip install --upgrade pip setuptools wheel; \
echo "The venv has been created in the $(VENVDIR) directory"; \
fi
.piptools: venv
$(BIN)/$(PY) -m pip install pip-tools
touch .piptools
requirements/requirements.txt: .piptools requirements/requirements.in
$(PY) -m piptools compile -o requirements/requirements.txt --no-header --no-annotate requirements/requirements.in
requirements/requirements-binaries.txt: .piptools requirements/requirements-binaries.in
$(PY) -m piptools compile -o requirements/requirements-binaries.txt --no-header --no-annotate requirements/requirements-binaries.in
requirements/requirements-dev.txt: .piptools requirements/requirements-dev.in
$(PY) -m piptools compile -o requirements/requirements-dev.txt --no-header --no-annotate requirements/requirements-dev.in
# Sync virtual environment with dependencies
.PHONY: build
build: requirements/requirements.txt requirements/requirements-binaries.txt
$(PY) -m piptools sync requirements/requirements.txt requirements/requirements-binaries.txt
.PHONY: dev
dev: requirements/requirements.txt requirements/requirements-binaries.txt requirements/requirements-dev.txt
$(PY) -m piptools sync requirements/requirements.txt requirements/requirements-binaries.txt requirements/requirements-dev.txt
.PHONY: lint
lint: dev
$(PY) -m flake8
format-check: dev
$(PY) -m black --check .
.PHONY: format
format: dev
$(PY) -m black .
.PHONY: translation
translation: build
$(PY) setup.py build_trans
.PHONY: test
test: translation
$(PY) -m unittest discover -s tests -v
.PHONY: test-cov
test-cov: dev
$(PY) -m pytest --cov-report term-missing --cov=youtube_dl_gui tests/ -vv
.PHONY: install
install: translation
$(PY) setup.py install
.PHONY: pyinstaller
pyinstaller: translation
$(PY) setup.py pyinstaller
.PHONY: typecheck
typecheck: dev
$(PY) -m mypy -p youtube_dl_gui
.PHONY: clean
clean: clean-build clean-requirements clean-test
.PHONY: clean-venv
clean-venv:
$(RMR) $(VENVDIR)
clean-build:
$(RMR) build dist *.egg-info
clean-requirements:
$(RM) .piptools
$(RM) requirements/requirements.txt
$(RM) requirements/requirements-binaries.txt
$(RM) requirements/requirements-dev.txt
clean-pyc:
find . -type f -name "*.pyc" -exec rm -f {} \;
find . -type f -name "*.pyo" -exec rm -f {} \;
-find . -type d -name "__pycache__" -exec rm -rf {} \;
clean-test:
$(RMR) .tox/ htmlcov/
$(RM) .coverage