Skip to content

Commit

Permalink
display version number
Browse files Browse the repository at this point in the history
  • Loading branch information
mzuther committed Dec 12, 2022
1 parent 1baa7a1 commit 1f0bba6
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 6 deletions.
41 changes: 41 additions & 0 deletions src/DirWalk/DirWalk.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 13 additions & 6 deletions src/StempelWerk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# ----------------------------------------------------------------------------
#
# StempelWerk 0.3
# ===============
# StempelWerk
# ===========
# Automatic code generation from Jinja2 templates
#
# Copyright (c) 2020-2022 Martin Zuther (https://www.mzuther.de/)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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])
Expand Down

0 comments on commit 1f0bba6

Please sign in to comment.