forked from KurimuzonAkuma/kurigram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (72 loc) · 2.59 KB
/
Makefile
File metadata and controls
96 lines (72 loc) · 2.59 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
VENV := venv
PYTHON := $(VENV)/bin/python
PIP := $(PYTHON) -m pip
TAG = v$(shell grep -E '__version__ = ".*"' pyrogram/__init__.py | cut -d\" -f2)
RM := rm -rf
GREEN := \033[0;32m
RED := \033[0;31m
YELLOW := \033[0;33m
BLUE := \033[0;34m
BOLD := \033[1m
RESET := \033[0m
.PHONY: venv venv-docs clean-venv clean-build clean-api clean-enums clean-docs clean api enums docs docs-archive build tag dtag schema-diff update-schema fetch-data
venv:
@if [ ! -d "$(VENV)" ]; then \
python3 -m venv $(VENV); \
$(PIP) install -U pip wheel setuptools; \
fi
$(PIP) install -U -e .
@printf "$(YELLOW)Created venv with %s$(RESET)\n" "$$($(PYTHON) --version)"
venv-docs:
@if [ ! -d "$(VENV)" ]; then \
python3 -m venv $(VENV); \
$(PIP) install -U pip wheel setuptools; \
fi
$(PIP) install -U -e .[docs]
@printf "$(YELLOW)Created docs venv with %s$(RESET)\n" "$$($(PYTHON) --version)"
clean-venv:
$(RM) $(VENV)
@printf "$(YELLOW)Cleaned venv directory$(RESET)\n"
clean-build:
$(RM) *.egg-info build dist
@printf "$(YELLOW)Cleaned build directory$(RESET)\n"
clean-api:
$(RM) pyrogram/errors/exceptions pyrogram/raw/all.py pyrogram/raw/base pyrogram/raw/functions pyrogram/raw/types
@printf "$(YELLOW)Cleaned api directory$(RESET)\n"
clean-enums:
find pyrogram/enums -name '*.py' ! -name 'auto_name.py' -delete
@printf "$(YELLOW)Cleaned enums directory$(RESET)\n"
clean-docs:
$(RM) docs/build docs/source/api/bound-methods docs/source/api/methods docs/source/api/types docs/source/api/enums docs/source/telegram
@printf "$(YELLOW)Cleaned docs directory$(RESET)\n"
clean: clean-venv clean-build clean-api clean-enums clean-docs
@printf "$(GREEN)Cleaned all directories$(RESET)\n"
api:
cd compiler/api && ../../$(PYTHON) compiler.py
cd compiler/errors && ../../$(PYTHON) compiler.py
cd compiler/enums && ../../$(PYTHON) compiler.py
docs:
cd compiler/docs && ../../$(PYTHON) compiler.py
$(VENV)/bin/sphinx-build -b dirhtml "docs/source" "docs/build/html" -j auto
docs-archive:
cd docs/build/html && zip -r ../docs.zip ./
build:
hatch build
tag:
git tag $(TAG)
git push origin $(TAG)
dtag:
git tag -d $(TAG)
git push origin -d $(TAG)
schema-diff:
cd compiler/api && ../../$(PYTHON) diff.py
update-schema:
curl -fsSL https://raw.githubusercontent.com/SychO3/tl-schema-merger/refs/heads/master/merged.tl -o compiler/api/source/main_api.tl
@printf "$(GREEN)Updated main_api.tl$(RESET)\n"
fetch-data:
cd compiler && ../$(PYTHON) gen_urls.py
cd compiler && ../$(PYTHON) fetch_data.py
enums:
cd compiler/enums && ../../$(PYTHON) compiler.py
check-enums:
cd compiler/enums && ../../$(PYTHON) check.py