-
-
Notifications
You must be signed in to change notification settings - Fork 422
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (78 loc) · 2.95 KB
/
Makefile
File metadata and controls
103 lines (78 loc) · 2.95 KB
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
.PHONY: all version clean setup install add-dep add-dev rm-dep rm-dev build-wheel build-exe build start watch lint pull remove-tag push-tag push-tag-force docker-build docker-up docker-down docker-logs
all: version install
VERSION := $(strip $(file < lncrawl/VERSION))
# Use uv from PATH, or from default install location after make setup
ifeq ($(OS),Windows_NT)
UV := $(shell powershell -NoProfile -Command "if (Get-Command uv -ErrorAction SilentlyContinue) { (Get-Command uv).Source } else { Join-Path $env:USERPROFILE '.local\bin\uv.exe' }")
else
UV := $(shell command -v uv 2>/dev/null || echo "$(HOME)/.local/bin/uv")
endif
version:
@echo Lightnovel Crawler: $(VERSION)
clean:
ifeq ($(OS),Windows_NT)
@powershell -Command "try { Remove-Item -ErrorAction SilentlyContinue -Recurse -Force .venv, logs, build, dist } catch {}; exit 0"
@powershell -Command "Get-ChildItem -ErrorAction SilentlyContinue -Recurse -Directory -Filter '*.egg-info' | Remove-Item -Recurse -Force"
@powershell -Command "Get-ChildItem -ErrorAction SilentlyContinue -Recurse -Directory -Filter '__pycache__' | Remove-Item -Recurse -Force"
else
@rm -rf .venv logs build dist
@find . -depth -name '*.egg-info' -type d -exec rm -rf '{}' \; 2>/dev/null || true
@find . -depth -name '__pycache__' -type d -exec rm -rf '{}' \; 2>/dev/null || true
endif
setup:
@git submodule sync
@git submodule update --init --remote --merge
ifeq ($(OS),Windows_NT)
@$(UV) --version || powershell -NoProfile -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
else
@$(UV) --version || (curl -LsSf https://astral.sh/uv/install.sh | sh)
endif
install: setup
$(UV) sync --extra dev
lint:
$(UV) run flake8 --config .flake8 -v --count --show-source --statistics
start:
$(UV) run python -m lncrawl -ll server
watch:
$(UV) run python -m lncrawl -ll server --watch
build-wheel:
$(UV) run python -m build -w
build-exe:
$(UV) run python setup_pyi.py
build: version install build-wheel build-exe
add-dep: setup
$(UV) add $(word 2,$(MAKECMDGOALS))
$(UV) sync --extra dev
add-dev: setup
$(UV) add --optional dev $(word 2,$(MAKECMDGOALS))
$(UV) sync --extra dev
rm-dep: setup
$(UV) remove $(word 2,$(MAKECMDGOALS))
$(UV) sync --extra dev
rm-dev: setup
$(UV) remove --optional dev $(word 2,$(MAKECMDGOALS))
$(UV) sync --extra dev
pull:
git pull --rebase --autostash
git submodule update --remote --merge
remove-tag:
git push --delete origin "v$(VERSION)"
git tag -d "v$(VERSION)"
push-tag: pull
git tag "v$(VERSION)"
git push --tags
push-tag-force: pull
git push --delete origin "v$(VERSION)"
git tag -d "v$(VERSION)"
git tag "v$(VERSION)"
git push --tags
docker-base:
docker build -t lncrawl-base -f Dockerfile.base .
docker-build: docker-base
docker build -t lncrawl --build-arg BASE_IMAGE=lncrawl-base .
docker-up:
docker compose -f scripts/local-compose.yml up -d
docker-down:
docker compose -f scripts/local-compose.yml down
docker-logs:
docker compose -f scripts/local-compose.yml logs -f