From 068cfc6a252f44799a7e9bd7914e90f72ad60091 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 28 Oct 2020 23:13:03 +0100 Subject: add logic to generate python enumeration file --- gnu-taler-error-codes/.gitignore | 1 + gnu-taler-error-codes/Makefile | 7 +++++++ gnu-taler-error-codes/py.header | 30 ++++++++++++++++++++++++++++++ gnu-taler-error-codes/py.template | 9 +++++++++ 4 files changed, 47 insertions(+) create mode 100644 gnu-taler-error-codes/py.header create mode 100644 gnu-taler-error-codes/py.template 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 @@ *.h *.tmp *.ts +taler_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 @@ 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 new file mode 100644 index 0000000..1d09d0d --- /dev/null +++ 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 . + + 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 new file mode 100644 index 0000000..292678d --- /dev/null +++ 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}} + -- cgit v1.2.3