# -*- coding: utf-8 -*-
"""
+@summary: Scripts and modules for tasks specific to Digitas Pixelpark.
+
@author: Frank Brehm
@contact: frank.brehm@pixelpark.com
@license: LGPL3+
-@copyright: © 2021 Frank Brehm, Digitas Pixelpark, Berlin
-@summary: Modules for handling the PowerDNS API
+@copyright: © 2023 Frank Brehm, Digitas Pixelpark, Berlin
"""
from __future__ import print_function
+import glob
import os
-import sys
-import re
import pprint
-import glob
+import re
import subprocess
-
+import sys
from pathlib import Path
-# Third party modules
-from setuptools import setup
-
-ENCODING = "utf-8"
+ENCODING = 'utf-8'
# own modules:
# __base_dir__ = os.path.abspath(os.path.dirname(__file__))
# -----------------------------------
def pp(obj):
+ """Return a pretty print string of the given value."""
pprinter = pprint.PrettyPrinter(indent=4)
return pprinter.pformat(obj)
if __module_dir__.exists() and __init_py__.is_file():
sys.path.insert(0, str(__lib_dir__))
+# Third party modules
import pp_admintools
+from setuptools import setup
+
__packet_version__ = pp_admintools.__version__
__packet_name__ = 'pp_admintools'
# -----------------------------------
def read(fname):
-
+ """Read the given file and return its contant."""
f = Path(fname)
return f.read_text()
# -----------------------------------
def is_python_file(filename):
+ """Return, whether the given file seems to be a Python source file."""
if str(filename).endswith('.py'):
return True
else:
# -----------------------------------
def read_requirements():
-
+ """Read the requiremments.txt file."""
req_file = __base_dir__ / 'requirements.txt'
if not req_file.is_file():
return
# print("Found required modules:\n" + pp(__requirements__) + '\n')
# -----------------------------------
-__scripts__ = [
- 'bin/check-ldap-dn-attributes',
- 'bin/dns-deploy-zones',
- 'bin/mirror-ldap-instance',
- 'bin/mkldappasswd',
- 'bin/remove-ldap-user',
- 'bin/set-ldap-password',
-]
+__scripts__ = []
+
+def get_scripts():
+ """Collect binary script files from bin/."""
+ fpattern = os.path.join(__bin_dir__, '*')
+ for fname in glob.glob(fpattern):
+ script_name = os.path.relpath(fname, __base_dir__)
+ if not os.path.isfile(fname):
+ continue
+ if not os.access(fname, os.X_OK):
+ continue
+
+ if script_name not in __scripts__:
+ __scripts__.append(script_name)
+
+ # print("Found scripts: {}\n".format(pp(__scripts__)))
+
-# print("Given scripts:\n" + pp(__scripts__) + "\n")
+get_scripts()
# -----------------------------------
__data_files__ = []
__package_data__ = {}
def create_mo_files():
+ """Compile the translation files."""
mo_files = []
for po_path in glob.glob(PO_FILES):
mo = Path(po_path.replace('.po', '.mo'))