commit 068cfc6a252f44799a7e9bd7914e90f72ad60091
parent 32acd55e3d886322dab80bfbed4e73f590013472
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 28 Oct 2020 23:13:03 +0100
add logic to generate python enumeration file
Diffstat:
4 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/gnu-taler-error-codes/.gitignore b/gnu-taler-error-codes/.gitignore
@@ -3,3 +3,4 @@
*.h
*.tmp
*.ts
+taler_error_codes.py
diff --git a/gnu-taler-error-codes/Makefile b/gnu-taler-error-codes/Makefile
@@ -1,6 +1,7 @@
FILES=taler_error_codes.h \
taler_error_codes.c \
taler_error_codes.ts \
+ taler_error_codes.py \
taler_error_codes.kt
all: check $(FILES)
@@ -58,5 +59,11 @@ taler_error_codes.kt.tmp: combined.tmp kt.template
taler_error_codes.kt: kt.header taler_error_codes.kt.tmp kt.footer
cat $^ > $@
+taler_error_codes.py.tmp: combined.tmp py.template
+ ../format.sh py.template < combined.tmp > $@
+
+taler_error_codes.py: py.header taler_error_codes.py.tmp
+ cat $^ > $@
+
.PHONY: check clean distclean prep
diff --git a/gnu-taler-error-codes/py.header b/gnu-taler-error-codes/py.header
@@ -0,0 +1,30 @@
+"""
+ This file is part of GNU Taler
+ Copyright (C) 2012-2020 Taler Systems SA
+
+ GNU Taler is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: LGPL3.0-or-later
+
+ Note: the LGPL does not apply to all components of GNU Taler,
+ but it does apply to this file.
+"""
+
+from enum import Enum,unique
+
+"""
+ Error codes used by GNU Taler.
+"""
+@unique
+class ErrorCode(Enum):
diff --git a/gnu-taler-error-codes/py.template b/gnu-taler-error-codes/py.template
@@ -0,0 +1,9 @@
+
+
+ """
+ {{Description}}
+ Returned with an HTTP status code of #MHD_HTTP_{{HttpStatus_Identifier}} ({{HttpStatus_Value}}).
+ (A value of 0 indicates that the error is generated client-side).
+ """
+ {{Name}} = {{Value}}
+