-
Notifications
You must be signed in to change notification settings - Fork 69
/
Makefile
57 lines (53 loc) · 1.73 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
# Get version related variables
export DATE=$(shell date +'%Y.%m.%d')
export DATE_COMMIT_COUNT=$(shell git rev-list --count HEAD --since="$(DATE) 00:00:00")
export COMMIT_HASH=$(shell git rev-parse --short HEAD)
# Set Local version to YYYY.MM.DD-<hash>
export LOCAL_VERSION="$(DATE)+$(COMMIT_HASH)"
# Set PyPi version to YYYY.MM.DD or YYYY.MM.DD.postN if N > 0
ifeq ("$(DATE_COMMIT_COUNT)", "0")
export PYPI_VERSION="$(DATE)"
else
export PYPI_VERSION="$(DATE).post$(DATE_COMMIT_COUNT)"
endif
lint:
@-isort .
@-black .
@-pylint src/
check_lint:
isort . --check-only --diff \
&& black . --check \
&& pylint src/
wheel: clean
$(shell echo "__pypi_version__ = \"$(PYPI_VERSION)\"" > src/ytdl_sub/__init__.py)
$(shell echo "__local_version__ = \"$(LOCAL_VERSION)\"" >> src/ytdl_sub/__init__.py)
cat src/ytdl_sub/__init__.py
pip3 install build
python3 -m build
docker_stage: wheel
cp dist/*.whl docker/root/
cp -R examples docker/root/defaults/
docker: docker_stage
sudo docker build --progress=plain --no-cache -t ytdl-sub:local docker/
docker_ubuntu: docker_stage
sudo docker build --progress=plain --no-cache -t ytdl-sub-ubuntu:local -f docker/Dockerfile.ubuntu docker/
docker_gui: docker_stage
sudo docker build --progress=plain --no-cache -t ytdl-sub-gui:local -f docker/Dockerfile.gui docker/
executable: clean
pyinstaller ytdl-sub.spec
mv dist/ytdl-sub dist/ytdl-sub${EXEC_SUFFIX}
docs:
REGENERATE_DOCS=1 pytest tests/unit/docgen/test_docgen.py
sphinx-build -M html docs/source/ docs/build/
clean:
rm -rf \
.pytest_cache/ \
build/ \
dist/ \
src/ytdl_sub.egg-info/ \
docs/build/ \
.coverage \
docker/root/*.whl \
docker/root/defaults/examples \
coverage.xml
.PHONY: lint check_lint wheel docker_stage docker docs clean