forked from Cog-Creators/Red-DiscordBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (52 loc) · 1.69 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
.DEFAULT_GOAL := help
PYTHON ?= python3.8
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
ifneq ($(wildcard $(ROOT_DIR)/.venv/.),)
VENV_PYTHON = $(ROOT_DIR)/.venv/bin/python
else
VENV_PYTHON = $(PYTHON)
endif
define HELP_BODY
Usage:
make <command>
Commands:
reformat Reformat all .py files being tracked by git.
stylecheck Check which tracked .py files need reformatting.
stylediff Show the post-reformat diff of the tracked .py files
without modifying them.
gettext Generate pot files.
upload_translations Upload pot files to Crowdin.
download_translations Download translations from Crowdin.
bumpdeps Run script bumping dependencies.
newenv Create or replace this project's virtual environment.
syncenv Sync this project's virtual environment to Red's latest
dependencies.
endef
export HELP_BODY
# Python Code Style
reformat:
$(VENV_PYTHON) -m black $(ROOT_DIR)
stylecheck:
$(VENV_PYTHON) -m black --check $(ROOT_DIR)
stylediff:
$(VENV_PYTHON) -m black --check --diff $(ROOT_DIR)
# Translations
gettext:
$(PYTHON) -m redgettext --command-docstrings --verbose --recursive redbot --exclude-files "redbot/pytest/**/*"
upload_translations:
crowdin upload sources
download_translations:
crowdin download
# Dependencies
bumpdeps:
$(PYTHON) tools/bumpdeps.py
# Development environment
newenv:
$(PYTHON) -m venv --clear .venv
.venv/bin/pip install -U pip wheel
$(MAKE) syncenv
syncenv:
.venv/bin/pip install -Ur ./tools/dev-requirements.txt
# Help
help:
@echo "$$HELP_BODY"