From 90808b2e127c9482a2b8da52dbc797e6c813b1f0 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 24 Sep 2019 16:28:48 +0200 Subject: [PATCH] Adding bin/create-terraform --- bin/create-terraform | 62 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 bin/create-terraform diff --git a/bin/create-terraform b/bin/create-terraform new file mode 100755 index 0000000..5dc499e --- /dev/null +++ b/bin/create-terraform @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import print_function + +import sys + +if sys.version_info[0] != 3: + print("This script is intended to use with Python3.", file=sys.stderr) + print("You are using Python: {0}.{1}.{2}-{3}-{4}.\n".format( + *sys.version_info), file=sys.stderr) + sys.exit(1) + +if sys.version_info[1] < 4: + print("A minimal Python version of 3.4 is necessary to execute this script.", file=sys.stderr) + print("You are using Python: {0}.{1}.{2}-{3}-{4}.\n".format( + *sys.version_info), file=sys.stderr) + sys.exit(1) + +import os +import logging +import locale + +# own modules: +cur_dir = os.getcwd() +base_dir = cur_dir + +if sys.argv[0] != '' and sys.argv[0] != '-c': + bin_dir = os.path.dirname(os.path.realpath(sys.argv[0])) +else: + bin_dir = os.path.dirname(os.path.realpath(__file__)) +base_dir = os.path.abspath(os.path.join(bin_dir, '..')) +lib_dir = os.path.join(base_dir, 'lib') +module_dir = os.path.join(lib_dir, 'cr_tf') +if os.path.exists(module_dir): + sys.path.insert(0, lib_dir) + +from cr_tf.app import CrTfApplication + +log = logging.getLogger(__name__) + +__author__ = 'Frank Brehm ' +__copyright__ = '(C) 2019 by Frank Brehm, Pixelpark GmbH, Berlin' + +appname = os.path.basename(sys.argv[0]) + +locale.setlocale(locale.LC_ALL, '') + +app = CrTfApplication(appname=appname, base_dir=base_dir) +app.initialized = True + +if app.verbose > 2: + print("{c}-Object:\n{a}".format(c=app.__class__.__name__, a=app)) + +app() + +if app.handler: + app.handler = None + +sys.exit(0) + +# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -- 2.39.5