summaryrefslogtreecommitdiff
path: root/Makefile
blob: 5e3adff7eb11e0899993af95d744133daef0948f (plain)
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
install_global=false
-include config.mk

version := $(shell poetry version | awk '{ print $$2 }')

.PHONY: all
all:
	@echo "This is a python project, no compilation required"
	@echo "Installation: make install"

.PHONY: install

ifeq ($(install_global), true)
install: install-global
else
install: install-local
endif

setup-arch:
# TODO: We should probabally add some form of "ignore me if already completed"
	set -e
	echo "WARN: This script has not been tested! Use with caution."
	echo "Upgrading System & Installing Python..."
	sudo pacman -Syu --noconfirm python python-pip python-flask-babel python-poetry python-babel
	echo "Configuring..."
	./configure --destination=local
	echo "Installing Pip Dependencies..."
	echo "-> Installing wheel..."
	pip install wheel
	echo "-> Installing uwsgi..."
	pip install uwsgi
	echo "-> Installing lxml..."
	pip install lxml
	echo "-> Installing poetry..."
	pip install poetry
	echo "Done!"

setup-deb:
# TODO: We should probabally add some form of "ignore me if already completed"
	set -e
	echo "WARN: This script has not been tested! Use with caution."
	echo "Updating Package Repositories..."
	sudo apt update -y
	echo "Installing python, python-flask-babel, python-pip, python-is-python3..."
	sudo apt install -y python3 python3-flask-babel python3-pip python-is-python3
	echo "Configuring..."
	./configure --destination=local
	echo "Installing Pip Dependencies..."
	echo "-> Installing wheel..."
	pip install wheel
	echo "-> Installing uwsgi..."
	pip install uwsgi
	echo "-> Installing lxml..."
	pip install lxml
	echo "-> Installing poetry..."
	pip install poetry
	echo "Done!"

.PHONY: install-global
install-global: compile
	poetry build -f wheel
	pip3 install --upgrade --ignore-installed "dist/talermerchantdemos-$(version)-py3-none-any.whl"

.PHONY: install-local
install-local: compile
	poetry build -f wheel
	pip3 install --upgrade --ignore-installed --user "dist/talermerchantdemos-$(version)-py3-none-any.whl"

# run testcases
.PHONY: check
check:
	@export TALER_CONFIG_FILE=talerblog/tests.conf; \
        python3 setup.py test

.PHONY: clean
clean:
	@echo nothing to do

.PHONY: dist
dist:
	git archive --format=tar.gz HEAD -o taler-merchant-blog.tar.gz

.PHONY: pretty
pretty:
	black talermerchantdemos

# i18n
extract:
#	Note: Flask-BabelEx expects 'translations/' for the dirname,
#       even though GNU gettext typically uses 'locale/'
	mkdir -p talermerchantdemos/translations
	pybabel extract -F babel.cfg -o talermerchantdemos/translations/messages.pot .
#	Add new language as follows:
#	pybabel init -i locale/messages.pot -d locale/ -l de

.PHONY: compile
compile: update
	pybabel compile -d talermerchantdemos/translations

.PHONY: update
update: extract
	pybabel update -i talermerchantdemos/translations/messages.pot -d talermerchantdemos/translations