From 005f1e1d4e840cfdab24753fb95fff219f4b4254 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 11 Apr 2024 15:55:04 +0200 Subject: [PATCH] Adding bin/get-intern-used-from-addresses --- bin/get-intern-used-from-addresses | 69 ++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 bin/get-intern-used-from-addresses diff --git a/bin/get-intern-used-from-addresses b/bin/get-intern-used-from-addresses new file mode 100755 index 0000000..ad63b46 --- /dev/null +++ b/bin/get-intern-used-from-addresses @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +""" +@summary: An application et all From-mail addresses, which are used in outbound mails. + +@author: Frank Brehm +@contact: frank.brehm@pixelpark.com +@copyright: © 2024 by Frank Brehm, Berlin +""" +from __future__ import print_function + +# Standard modules +import locale +import os +import sys + +try: + from pathlib import Path +except ImportError: + from pathlib2 import Path + +__exp_py_version_major__ = 3 +__min_py_version_minor__ = 6 + +if sys.version_info[0] != __exp_py_version_major__: + print('This script is intended to use with Python {}.'.format( + __exp_py_version_major__), file=sys.stderr) + print('You are using Python: {0}.{1}.{2}-{3}-{4}.'.format( + *sys.version_info) + '\n', file=sys.stderr) + sys.exit(1) + +if sys.version_info[1] < __min_py_version_minor__: + print('A minimal Python version of {maj}.{min} is necessary to execute this script.'.format( + maj=__exp_py_version_major__, min=__min_py_version_minor__), file=sys.stderr) + print('You are using Python: {0}.{1}.{2}-{3}-{4}.'.format( + *sys.version_info) + '\n', file=sys.stderr) + sys.exit(1) + +__author__ = 'Frank Brehm ' +__copyright__ = '(C) 2024 by Frank Brehm, Digitas Pixelpark GmbH, Berlin' + +# own modules: + +my_path = Path(__file__) +my_real_path = my_path.resolve() +bin_path = my_real_path.parent +base_dir = bin_path.parent +lib_dir = base_dir.joinpath('lib') +module_dir = lib_dir.joinpath('pp_admintools') + +if module_dir.exists(): + sys.path.insert(0, str(lib_dir)) + +from pp_admintools.app.get_from_addr import GetFromAddressesApp + +appname = os.path.basename(sys.argv[0]) + +locale.setlocale(locale.LC_ALL, '') + +app = GetFromAddressesApp(appname=appname, base_dir=base_dir) +app.initialized = True + +if app.verbose > 1: + print('{c}-Object:\n{a}'.format(c=app.__class__.__name__, a=app)) + +app() + +sys.exit(0) + +# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -- 2.39.5