Makefile (2677B)
1 install_global=false 2 -include .config.mk 3 4 version := $(shell poetry version | awk '{ print $$2 }') 5 6 .PHONY: all 7 all: 8 @echo "This is a python project, no compilation required" 9 @echo "Installation: make install" 10 11 setup-arch: 12 # TODO: We should probabally add some form of "ignore me if already completed" 13 set -e 14 echo "WARN: This script has not been tested! Use with caution." 15 echo "Upgrading System & Installing Python..." 16 sudo pacman -Syu --noconfirm python python-pip python-flask-babel python-poetry python-babel 17 echo "Configuring..." 18 ./configure --prefix=local 19 echo "Installing Pip Dependencies..." 20 echo "-> Installing wheel..." 21 pip install wheel 22 echo "-> Installing lxml..." 23 pip install lxml 24 echo "-> Installing poetry..." 25 pip install poetry 26 echo "Done!" 27 28 setup-deb: 29 # TODO: We should probabally add some form of "ignore me if already completed" 30 set -e 31 echo "WARN: This script has not been tested! Use with caution." 32 echo "Updating Package Repositories..." 33 sudo apt update -y 34 echo "Installing python, python-flask-babel, python-pip, python-is-python3..." 35 sudo apt install -y python3 python3-flask-babel python3-pip python-is-python3 36 echo "Configuring..." 37 ./configure --prefix=local 38 echo "Installing Pip Dependencies..." 39 echo "-> Installing wheel..." 40 pip install wheel 41 echo "-> Installing lxml..." 42 pip install lxml 43 echo "-> Installing poetry..." 44 pip install poetry 45 echo "Done!" 46 47 my_venv = $(DESTDIR)$(prefix)/lib/taler-merchant-demos/venv 48 bindir = $(DESTDIR)$(prefix)/bin 49 50 .PHONY: install 51 install: compile 52 mkdir -p $(bindir) 53 poetry build -f wheel 54 python3 -m venv $(my_venv) 55 $(my_venv)/bin/pip3 install --upgrade --ignore-installed "dist/talermerchantdemos-$(version)-py3-none-any.whl" 56 ln -sf ../lib/taler-merchant-demos/venv/bin/taler-merchant-demos $(bindir)/taler-merchant-demos 57 58 # run testcases 59 .PHONY: check 60 check: 61 @export TALER_CONFIG_FILE=talerblog/tests.conf; \ 62 python3 setup.py test 63 64 .PHONY: clean 65 clean: 66 @echo nothing to do 67 68 .PHONY: dist 69 dist: 70 git archive --format=tar.gz HEAD -o taler-merchant-blog.tar.gz 71 72 .PHONY: pretty 73 pretty: 74 black talermerchantdemos 75 76 # i18n 77 extract: 78 # Note: Flask-BabelEx expects 'translations/' for the dirname, 79 # even though GNU gettext typically uses 'locale/' 80 mkdir -p talermerchantdemos/translations 81 pybabel extract -F babel.cfg -o talermerchantdemos/translations/messages.pot . 82 # Add new language as follows: 83 # pybabel init -i locale/messages.pot -d locale/ -l de 84 85 .PHONY: compile 86 compile: update 87 pybabel compile -d talermerchantdemos/translations 88 89 .PHONY: update 90 update: extract 91 pybabel update -i talermerchantdemos/translations/messages.pot -d talermerchantdemos/translations 92