2021-02-16 19:28:30 +01:00
|
|
|
ifeq ($(ISPROD), 1)
|
|
|
|
DOCKER_LOCAL := docker-compose -f production.yml
|
|
|
|
else
|
|
|
|
DOCKER_LOCAL := docker-compose -f local.yml
|
|
|
|
endif
|
2020-06-11 01:06:30 +02:00
|
|
|
|
2021-02-16 19:28:30 +01:00
|
|
|
INSTANCE := preprod
|
|
|
|
|
|
|
|
DOCKER_TUXBOT := $(DOCKER_LOCAL) run --rm tuxbot
|
|
|
|
VIRTUAL_ENV := venv
|
|
|
|
PYTHON_PATH := $(VIRTUAL_ENV)/bin/python
|
|
|
|
|
|
|
|
XGETTEXT_FLAGS := --no-wrap --language='python' --keyword=_ --from-code='UTF-8' --msgid-bugs-address='rick@gnous.eu' --width=79 --package-name='Tuxbot-bot'
|
2020-06-07 18:29:55 +02:00
|
|
|
|
|
|
|
# Init
|
2021-02-16 19:28:30 +01:00
|
|
|
.PHONY: main
|
2020-06-07 18:29:55 +02:00
|
|
|
main:
|
2021-02-16 19:28:30 +01:00
|
|
|
$(VIRTUAL_ENV)/bin/pip install -U pip setuptools
|
|
|
|
|
|
|
|
.PHONY: install
|
2020-06-07 18:29:55 +02:00
|
|
|
install:
|
2021-02-16 19:28:30 +01:00
|
|
|
$(VIRTUAL_ENV)/bin/pip install .
|
|
|
|
|
|
|
|
.PHONY: install-dev
|
2020-11-08 01:07:27 +01:00
|
|
|
install-dev:
|
2021-02-16 19:28:30 +01:00
|
|
|
$(VIRTUAL_ENV)/bin/pip install -r dev.requirements.txt
|
|
|
|
|
|
|
|
.PHONY: update
|
2020-06-07 18:29:55 +02:00
|
|
|
update:
|
2021-02-16 19:28:30 +01:00
|
|
|
$(VIRTUAL_ENV)/bin/pip install --upgrade .
|
|
|
|
|
|
|
|
.PHONY: update-all
|
|
|
|
update-all:
|
|
|
|
$(VIRTUAL_ENV)/bin/pip install --upgrade --force-reinstall .
|
|
|
|
|
|
|
|
.PHONY: dev
|
2021-04-20 17:30:05 +02:00
|
|
|
dev: style update
|
2021-05-16 23:21:27 +02:00
|
|
|
$(VIRTUAL_ENV)/bin/tuxbot
|
2021-02-16 19:28:30 +01:00
|
|
|
|
|
|
|
# Docker
|
|
|
|
.PHONY: docker
|
|
|
|
docker:
|
|
|
|
$(DOCKER_LOCAL) build
|
|
|
|
$(DOCKER_LOCAL) up -d
|
|
|
|
|
|
|
|
.PHONY: docker-start
|
|
|
|
docker-start:
|
|
|
|
$(DOCKER_TUXBOT) tuxbot
|
2020-06-07 17:41:34 +02:00
|
|
|
|
2021-01-22 10:22:39 +01:00
|
|
|
|
2020-06-07 17:41:34 +02:00
|
|
|
# Blackify code
|
2021-02-16 19:28:30 +01:00
|
|
|
.PHONY: black
|
2021-02-11 18:11:19 +01:00
|
|
|
black:
|
2021-03-31 18:08:41 +02:00
|
|
|
$(PYTHON_PATH) -m black `git ls-files "*.py"` --line-length=79
|
|
|
|
|
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
|
|
|
$(PYTHON_PATH) -m pylint tuxbot
|
|
|
|
|
|
|
|
.PHONY: type
|
|
|
|
type:
|
|
|
|
$(PYTHON_PATH) -m mypy tuxbot
|
|
|
|
|
|
|
|
.PHONY: style
|
|
|
|
style: black lint type
|
2020-06-11 01:06:30 +02:00
|
|
|
|
|
|
|
# Translations
|
2021-02-16 19:28:30 +01:00
|
|
|
.PHONY: xgettext
|
2020-06-11 01:06:30 +02:00
|
|
|
xgettext:
|
|
|
|
for cog in tuxbot/cogs/*/; do \
|
|
|
|
xgettext `find $$cog -type f -name '*.py'` --output=$$cog/locales/messages.pot $(XGETTEXT_FLAGS); \
|
|
|
|
done
|
2021-02-16 19:28:30 +01:00
|
|
|
|
|
|
|
.PHONY: msginit
|
2020-06-11 01:06:30 +02:00
|
|
|
msginit:
|
|
|
|
for cog in tuxbot/cogs/*/; do \
|
|
|
|
msginit --input=$$cog/locales/messages.pot --output=$$cog/locales/fr-FR.po --locale=fr_FR.UTF-8 --no-translator; \
|
|
|
|
msginit --input=$$cog/locales/messages.pot --output=$$cog/locales/en-US.po --locale=en_US.UTF-8 --no-translator; \
|
|
|
|
done
|
2021-02-16 19:28:30 +01:00
|
|
|
|
|
|
|
.PHONY: msgmerge
|
2020-06-11 01:06:30 +02:00
|
|
|
msgmerge:
|
|
|
|
for cog in tuxbot/cogs/*/; do \
|
|
|
|
msgmerge --update $$cog/locales/fr-FR.po $$cog/locales/messages.pot; \
|
|
|
|
msgmerge --update $$cog/locales/en-US.po $$cog/locales/messages.pot; \
|
|
|
|
done
|