forked from oleksis/youtube-dl-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
100 lines (77 loc) · 2.28 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
# System python interpreter. Used only to create virtual environment
PY=python3
VENV=venv
BIN=$(VENV)/bin
TOUCH=touch
RM=rm -f
SEP=/
ACTIVATE=source $(BIN)/activate
ifeq ($(OS), Windows_NT)
PY=python
BIN=$(VENV)/Scripts
TOUCH=echo "" >
RM=del /Q
SEP=\\
ACTIVATE=$(BIN)/activate
endif
all: format lint test
$(VENV):
$(PY) -m venv $(VENV)
@echo Activate the Virtual Environment for next targets!
@echo $(ACTIVATE)
.piptools: $(VENV)
$(PY) -m pip install --upgrade pip setuptools wheel
$(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-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
$(PY) -m piptools sync requirements/requirements.txt
.PHONY: dev
dev: requirements/requirements.txt requirements/requirements-dev.txt
$(PY) -m piptools sync requirements/requirements.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-pyc clean-test
clean-build:
rm -rf build dist *.egg-info
clean-requirements:
${RM} .piptools
${RM} requirements${SEP}requirements-dev.txt
${RM} requirements${SEP}requirements.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:
rm -rf .tox/ htmlcov/
rm -f .coverage