summaryrefslogtreecommitdiff
path: root/Makefile
blob: ea6a78d3f9b3cc41916a0b1c2b5c1d402265a498 (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
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

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!"

my_venv = $(DESTDIR)$(prefix)/lib/taler-merchant-demos/venv
bindir = $(DESTDIR)$(prefix)/bin

.PHONY: install
install: compile
	mkdir -p $(bindir)
	poetry build -f wheel
	python3 -m venv $(my_venv)
	$(my_venv)/bin/pip3 install --upgrade --ignore-installed "dist/talermerchantdemos-$(version)-py3-none-any.whl"
	ln -sf ../lib/taler-merchant-demos/venv/bin/taler-merchant-demos $(bindir)/taler-merchant-demos

# 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