aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-10-28 23:13:03 +0100
committerChristian Grothoff <christian@grothoff.org>2020-10-28 23:13:03 +0100
commit068cfc6a252f44799a7e9bd7914e90f72ad60091 (patch)
treecbcd5fb3dd87dd7239048b6da41428da34208080
parent32acd55e3d886322dab80bfbed4e73f590013472 (diff)
downloadgana-068cfc6a252f44799a7e9bd7914e90f72ad60091.tar.gz
gana-068cfc6a252f44799a7e9bd7914e90f72ad60091.zip
add logic to generate python enumeration file
-rw-r--r--gnu-taler-error-codes/.gitignore1
-rw-r--r--gnu-taler-error-codes/Makefile7
-rw-r--r--gnu-taler-error-codes/py.header30
-rw-r--r--gnu-taler-error-codes/py.template9
4 files changed, 47 insertions, 0 deletions
diff --git a/gnu-taler-error-codes/.gitignore b/gnu-taler-error-codes/.gitignore
index 2379b4c..2eed484 100644
--- a/gnu-taler-error-codes/.gitignore
+++ b/gnu-taler-error-codes/.gitignore
@@ -3,3 +3,4 @@
3*.h 3*.h
4*.tmp 4*.tmp
5*.ts 5*.ts
6taler_error_codes.py
diff --git a/gnu-taler-error-codes/Makefile b/gnu-taler-error-codes/Makefile
index 502c6f2..b7885f5 100644
--- a/gnu-taler-error-codes/Makefile
+++ b/gnu-taler-error-codes/Makefile
@@ -1,6 +1,7 @@
1FILES=taler_error_codes.h \ 1FILES=taler_error_codes.h \
2 taler_error_codes.c \ 2 taler_error_codes.c \
3 taler_error_codes.ts \ 3 taler_error_codes.ts \
4 taler_error_codes.py \
4 taler_error_codes.kt 5 taler_error_codes.kt
5 6
6all: check $(FILES) 7all: check $(FILES)
@@ -58,5 +59,11 @@ taler_error_codes.kt.tmp: combined.tmp kt.template
58taler_error_codes.kt: kt.header taler_error_codes.kt.tmp kt.footer 59taler_error_codes.kt: kt.header taler_error_codes.kt.tmp kt.footer
59 cat $^ > $@ 60 cat $^ > $@
60 61
62taler_error_codes.py.tmp: combined.tmp py.template
63 ../format.sh py.template < combined.tmp > $@
64
65taler_error_codes.py: py.header taler_error_codes.py.tmp
66 cat $^ > $@
67
61 68
62.PHONY: check clean distclean prep 69.PHONY: check clean distclean prep
diff --git a/gnu-taler-error-codes/py.header b/gnu-taler-error-codes/py.header
new file mode 100644
index 0000000..1d09d0d
--- /dev/null
+++ b/gnu-taler-error-codes/py.header
@@ -0,0 +1,30 @@
1"""
2 This file is part of GNU Taler
3 Copyright (C) 2012-2020 Taler Systems SA
4
5 GNU Taler is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Lesser General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNU Taler is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: LGPL3.0-or-later
19
20 Note: the LGPL does not apply to all components of GNU Taler,
21 but it does apply to this file.
22"""
23
24from enum import Enum,unique
25
26"""
27 Error codes used by GNU Taler.
28"""
29@unique
30class ErrorCode(Enum):
diff --git a/gnu-taler-error-codes/py.template b/gnu-taler-error-codes/py.template
new file mode 100644
index 0000000..292678d
--- /dev/null
+++ b/gnu-taler-error-codes/py.template
@@ -0,0 +1,9 @@
1
2
3 """
4 {{Description}}
5 Returned with an HTTP status code of #MHD_HTTP_{{HttpStatus_Identifier}} ({{HttpStatus_Value}}).
6 (A value of 0 indicates that the error is generated client-side).
7 """
8 {{Name}} = {{Value}}
9