From 1f0bba672d66f3a2ad5a24021baf72bae042bd13 Mon Sep 17 00:00:00 2001 From: Martin Zuther Date: Mon, 12 Dec 2022 21:25:28 +0100 Subject: [PATCH] display version number --- src/DirWalk/DirWalk.py | 41 +++++++++++++++++++++++++++++++++++++++++ src/StempelWerk.py | 19 +++++++++++++------ 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/src/DirWalk/DirWalk.py b/src/DirWalk/DirWalk.py index f1490f8..1a59678 100644 --- a/src/DirWalk/DirWalk.py +++ b/src/DirWalk/DirWalk.py @@ -1,5 +1,46 @@ #!/usr/bin/env python3 +# ---------------------------------------------------------------------------- +# +# DirWalk +# ======= +# Custom directory walker +# +# Copyright (c) 2022 Martin Zuther (https://www.mzuther.de/) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Thank you for using free software! +# +# ---------------------------------------------------------------------------- + import math import os import sys diff --git a/src/StempelWerk.py b/src/StempelWerk.py index f506cb3..86e9afd 100644 --- a/src/StempelWerk.py +++ b/src/StempelWerk.py @@ -2,8 +2,8 @@ # ---------------------------------------------------------------------------- # -# StempelWerk 0.3 -# =============== +# StempelWerk +# =========== # Automatic code generation from Jinja2 templates # # Copyright (c) 2020-2022 Martin Zuther (https://www.mzuther.de/) @@ -53,6 +53,9 @@ import jinja2 from DirWalk.DirWalk import dirwalk + +VERSION = '0.3.0' + # ensure that this script can be called from anywhere script_dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(script_dir) @@ -224,6 +227,13 @@ def process_templates(settings): render_template(settings, cached_templates, template_filename) +def display_version(): + print() + print(f'[ StempelWerk v{ VERSION } (c) 2020-2022 Martin Zuther ]') + print('[ Licensed under the BSD 3-Clause License ]') + print() + + if __name__ == '__main__': if len(sys.argv) < 2: print() @@ -232,10 +242,7 @@ def process_templates(settings): exit(1) - print() - print('Python: {}'.format(sys.version)) - print('Jinja2: {}'.format(jinja2.__version__)) - print() + display_version() # settings path is relative to the path of this script settings_path = os.path.join(script_dir, sys.argv[1])