From 289c34c6a3397c5937cbb2818263276609ef9cd6 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 5 Sep 2022 17:17:24 +0200 Subject: [PATCH] Sorting modules into appropriate sub dirs --- bin/dns-deploy-zones | 2 +- bin/remove-ldap-user | 2 +- lib/pp_admintools/{apps => app}/__init__.py | 1 - .../dns_deploy_zones.py} | 10 ++++----- .../{ldap_app.py => app/ldap.py} | 18 +++++++-------- .../{mail_app.py => app/mail.py} | 14 ++++++------ .../{pdns_app.py => app/pdns.py} | 14 ++++++------ .../{apps => app}/remove_ldap_user.py | 6 ++--- .../{config.py => config/__init__.py} | 6 ++--- .../dns_deploy_zones.py} | 8 +++---- .../{ldap_config.py => config/ldap.py} | 6 ++--- .../{mail_config.py => config/mail.py} | 8 +++---- .../{pdns_config.py => config/pdns.py} | 12 +++++----- test/test_05_mailcfg.py | 18 +++++++-------- test/test_06_ldapcfg.py | 22 +++++++++---------- 15 files changed, 73 insertions(+), 74 deletions(-) rename lib/pp_admintools/{apps => app}/__init__.py (98%) rename lib/pp_admintools/{dns_deploy_zones_app.py => app/dns_deploy_zones.py} (99%) rename lib/pp_admintools/{ldap_app.py => app/ldap.py} (96%) rename lib/pp_admintools/{mail_app.py => app/mail.py} (97%) rename lib/pp_admintools/{pdns_app.py => app/pdns.py} (98%) rename lib/pp_admintools/{apps => app}/remove_ldap_user.py (91%) rename lib/pp_admintools/{config.py => config/__init__.py} (97%) rename lib/pp_admintools/{dns_deploy_zones_config.py => config/dns_deploy_zones.py} (99%) rename lib/pp_admintools/{ldap_config.py => config/ldap.py} (99%) rename lib/pp_admintools/{mail_config.py => config/mail.py} (98%) rename lib/pp_admintools/{pdns_config.py => config/pdns.py} (98%) diff --git a/bin/dns-deploy-zones b/bin/dns-deploy-zones index 9c23cc3..93f617f 100755 --- a/bin/dns-deploy-zones +++ b/bin/dns-deploy-zones @@ -43,7 +43,7 @@ module_dir = lib_dir.joinpath('pp_admintools') if module_dir.exists(): sys.path.insert(0, str(lib_dir)) -from pp_admintools.dns_deploy_zones_app import PpDeployZonesApp +from pp_admintools.app.dns_deploy_zones import PpDeployZonesApp __author__ = 'Frank Brehm ' __copyright__ = '(C) 2022 by Frank Brehm, Pixelpark GmbH, Berlin' diff --git a/bin/remove-ldap-user b/bin/remove-ldap-user index 47ab83f..b85ae36 100755 --- a/bin/remove-ldap-user +++ b/bin/remove-ldap-user @@ -46,7 +46,7 @@ module_dir = lib_dir.joinpath('pp_admintools') if module_dir.exists(): sys.path.insert(0, str(lib_dir)) -from pp_admintools.apps.remove_ldap_user import RemoveLdapUserApplication +from pp_admintools.app.remove_ldap_user import RemoveLdapUserApplication appname = os.path.basename(sys.argv[0]) diff --git a/lib/pp_admintools/apps/__init__.py b/lib/pp_admintools/app/__init__.py similarity index 98% rename from lib/pp_admintools/apps/__init__.py rename to lib/pp_admintools/app/__init__.py index 41823bf..892def3 100644 --- a/lib/pp_admintools/apps/__init__.py +++ b/lib/pp_admintools/app/__init__.py @@ -4,4 +4,3 @@ __version__ = '0.1.0' # vim: ts=4 et list - diff --git a/lib/pp_admintools/dns_deploy_zones_app.py b/lib/pp_admintools/app/dns_deploy_zones.py similarity index 99% rename from lib/pp_admintools/dns_deploy_zones_app.py rename to lib/pp_admintools/app/dns_deploy_zones.py index 0b693f8..c2cbcdf 100644 --- a/lib/pp_admintools/dns_deploy_zones_app.py +++ b/lib/pp_admintools/app/dns_deploy_zones.py @@ -36,15 +36,15 @@ from fb_tools.app import BaseApplication from fb_tools.pidfile import PidFileError, PidFile -from . import __version__ as GLOBAL_VERSION +from .. import __version__ as GLOBAL_VERSION -from .pdns_app import PpPDNSAppError, PpPDNSApplication +from .pdns import PpPDNSAppError, PpPDNSApplication -from .dns_deploy_zones_config import DnsDeployZonesConfig +from ..config.dns_deploy_zones import DnsDeployZonesConfig -from .xlate import XLATOR +from ..xlate import XLATOR -__version__ = '0.8.2' +__version__ = '0.8.3' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/ldap_app.py b/lib/pp_admintools/app/ldap.py similarity index 96% rename from lib/pp_admintools/ldap_app.py rename to lib/pp_admintools/app/ldap.py index d88de65..98c7c0a 100644 --- a/lib/pp_admintools/ldap_app.py +++ b/lib/pp_admintools/app/ldap.py @@ -23,20 +23,20 @@ from fb_tools.cfg_app import FbConfigApplication from fb_tools.errors import FbAppError # Own modules -from . import __version__ as GLOBAL_VERSION +from .. import __version__ as GLOBAL_VERSION -from .xlate import XLATOR +from ..xlate import XLATOR -from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR +from .. import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR -# from .argparse_actions import PortOptionAction +# from ..argparse_actions import PortOptionAction -# from .ldap_config import LdapConfigError -from .ldap_config import LdapConnectionInfo, LdapConfiguration -# rom .ldap_config import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS -from .ldap_config import DEFAULT_TIMEOUT, MAX_TIMEOUT +# from ..config.ldap import LdapConfigError +from ..config.ldap import LdapConnectionInfo, LdapConfiguration +# rom ..config.ldap import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS +from ..config.ldap import DEFAULT_TIMEOUT, MAX_TIMEOUT -__version__ = '0.1.3' +__version__ = '0.1.4' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/mail_app.py b/lib/pp_admintools/app/mail.py similarity index 97% rename from lib/pp_admintools/mail_app.py rename to lib/pp_admintools/app/mail.py index 0cee324..0cbae47 100644 --- a/lib/pp_admintools/mail_app.py +++ b/lib/pp_admintools/app/mail.py @@ -32,17 +32,17 @@ from fb_tools.xlate import format_list from fb_tools import MailAddress # Own modules -from . import __version__ as GLOBAL_VERSION -from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR +from .. import __version__ as GLOBAL_VERSION +from .. import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR -from .xlate import XLATOR +from ..xlate import XLATOR -from .argparse_actions import PortOptionAction +from ..argparse_actions import PortOptionAction -from .mail_config import MailConfiguration -from .mail_config import VALID_MAIL_METHODS +from ..config.mail import MailConfiguration +from ..config.mail import VALID_MAIL_METHODS -__version__ = '0.2.7' +__version__ = '0.2.8' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/pdns_app.py b/lib/pp_admintools/app/pdns.py similarity index 98% rename from lib/pp_admintools/pdns_app.py rename to lib/pp_admintools/app/pdns.py index 7fc33ca..76118dc 100644 --- a/lib/pp_admintools/pdns_app.py +++ b/lib/pp_admintools/app/pdns.py @@ -29,18 +29,18 @@ from fb_pdnstools.errors import PDNSApiNotFoundError from fb_pdnstools.errors import PDNSApiValidationError from fb_tools.xlate import format_list -from . import __version__ as GLOBAL_VERSION +from .. import __version__ as GLOBAL_VERSION -from .argparse_actions import PortOptionAction, TimeoutOptionAction +from ..argparse_actions import PortOptionAction, TimeoutOptionAction -from .mail_app import MailAppError, BaseMailApplication +from ..app.mail import MailAppError, BaseMailApplication -from .pdns_config import PdnsConfiguration -# from .pdns_config import PdnsConfigError, PdnsConfiguration +from ..config.pdns import PdnsConfiguration +# from ..config.pdns import PdnsConfigError, PdnsConfiguration -from .xlate import XLATOR +from ..xlate import XLATOR -__version__ = '0.9.1' +__version__ = '0.9.2' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/apps/remove_ldap_user.py b/lib/pp_admintools/app/remove_ldap_user.py similarity index 91% rename from lib/pp_admintools/apps/remove_ldap_user.py rename to lib/pp_admintools/app/remove_ldap_user.py index 7e22745..29670cc 100644 --- a/lib/pp_admintools/apps/remove_ldap_user.py +++ b/lib/pp_admintools/app/remove_ldap_user.py @@ -15,10 +15,10 @@ import logging # Own modules from ..xlate import XLATOR -from ..ldap_app import LdapAppError -from ..ldap_app import BaseLdapApplication +from ..app.ldap import LdapAppError +from ..app.ldap import BaseLdapApplication -__version__ = '0.1.0' +__version__ = '0.1.1' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/config.py b/lib/pp_admintools/config/__init__.py similarity index 97% rename from lib/pp_admintools/config.py rename to lib/pp_admintools/config/__init__.py index df09b38..b8556b6 100644 --- a/lib/pp_admintools/config.py +++ b/lib/pp_admintools/config/__init__.py @@ -24,12 +24,12 @@ from fb_tools import MailAddress # Own modules -from .errors import PpError +from ..errors import PpError -from .xlate import XLATOR +from ..xlate import XLATOR CONFIG_DIR = 'pixelpark' -__version__ = '0.1.2' +__version__ = '0.1.3' LOG = logging.getLogger(__name__) VALID_MAIL_METHODS = ('smtp', 'sendmail') diff --git a/lib/pp_admintools/dns_deploy_zones_config.py b/lib/pp_admintools/config/dns_deploy_zones.py similarity index 99% rename from lib/pp_admintools/dns_deploy_zones_config.py rename to lib/pp_admintools/config/dns_deploy_zones.py index 76de842..d90c819 100644 --- a/lib/pp_admintools/dns_deploy_zones_config.py +++ b/lib/pp_admintools/config/dns_deploy_zones.py @@ -26,12 +26,12 @@ from fb_tools.common import is_sequence, pp, to_bool # from .config import ConfigError, BaseConfiguration from fb_tools.multi_config import DEFAULT_ENCODING -from .pdns_config import PdnsConfigError, PdnsConfiguration -from .mail_config import DEFAULT_CONFIG_DIR +from .pdns import PdnsConfigError, PdnsConfiguration +from .mail import DEFAULT_CONFIG_DIR -from .xlate import XLATOR +from ..xlate import XLATOR -__version__ = '0.2.1' +__version__ = '0.2.2' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/ldap_config.py b/lib/pp_admintools/config/ldap.py similarity index 99% rename from lib/pp_admintools/ldap_config.py rename to lib/pp_admintools/config/ldap.py index 42bd061..377d892 100644 --- a/lib/pp_admintools/ldap_config.py +++ b/lib/pp_admintools/config/ldap.py @@ -26,11 +26,11 @@ from fb_tools.multi_config import DEFAULT_ENCODING from fb_tools.obj import FbGenericBaseObject, FbBaseObject -from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR +from .. import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR -from .xlate import XLATOR +from ..xlate import XLATOR -__version__ = '0.2.5' +__version__ = '0.2.6' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/mail_config.py b/lib/pp_admintools/config/mail.py similarity index 98% rename from lib/pp_admintools/mail_config.py rename to lib/pp_admintools/config/mail.py index f55d17b..5f8527c 100644 --- a/lib/pp_admintools/mail_config.py +++ b/lib/pp_admintools/config/mail.py @@ -29,12 +29,12 @@ from fb_tools.multi_config import DEFAULT_ENCODING from fb_tools import MailAddress -from . import __version__ as GLOBAL_VERSION -from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR +from .. import __version__ as GLOBAL_VERSION +from .. import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR -from .xlate import XLATOR +from ..xlate import XLATOR -__version__ = '0.1.10' +__version__ = '0.1.11' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/pdns_config.py b/lib/pp_admintools/config/pdns.py similarity index 98% rename from lib/pp_admintools/pdns_config.py rename to lib/pp_admintools/config/pdns.py index d3e1a06..31e97c7 100644 --- a/lib/pp_admintools/pdns_config.py +++ b/lib/pp_admintools/config/pdns.py @@ -24,17 +24,17 @@ from fb_tools.common import is_sequence, pp # from .config import ConfigError, BaseConfiguration from fb_tools.multi_config import DEFAULT_ENCODING -from . import __version__ as GLOBAL_VERSION -from . import MAX_TIMEOUT, MAX_PORT_NUMBER +from .. import __version__ as GLOBAL_VERSION +from .. import MAX_TIMEOUT, MAX_PORT_NUMBER -from .mail_config import MailConfigError, MailConfiguration -from .mail_config import DEFAULT_CONFIG_DIR +from .mail import MailConfigError, MailConfiguration +from .mail import DEFAULT_CONFIG_DIR -from .xlate import XLATOR +from ..xlate import XLATOR LIBRARY_NAME = "pp-pdns-api-client" -__version__ = '0.2.2' +__version__ = '0.2.3' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/test/test_05_mailcfg.py b/test/test_05_mailcfg.py index 530ab98..47f6741 100755 --- a/test/test_05_mailcfg.py +++ b/test/test_05_mailcfg.py @@ -26,7 +26,7 @@ sys.path.insert(0, libdir) from general import PpAdminToolsTestcase, get_arg_verbose, init_root_logger -from fb_tools.common import pp, to_str, is_sequence +# from fb_tools.common import pp, to_str, is_sequence LOG = logging.getLogger('test-mailcfg') @@ -50,23 +50,23 @@ class TestMailConfig(PpAdminToolsTestcase): # ------------------------------------------------------------------------- def test_import(self): - LOG.info("Testing import of pp_admintools.mail_config ...") - import pp_admintools.mail_config + LOG.info("Testing import of pp_admintools.config.mail ...") + import pp_admintools.config.mail LOG.debug( - "Version of pp_admintools.mail_config: " + pp_admintools.mail_config.__version__) + "Version of pp_admintools.config.mail: " + pp_admintools.config.mail.__version__) - LOG.info("Testing import of MailConfigError from pp_admintools.mail_config ...") - from pp_admintools.mail_config import MailConfigError # noqa + LOG.info("Testing import of MailConfigError from pp_admintools.config.mail ...") + from pp_admintools.config.mail import MailConfigError # noqa - LOG.info("Testing import of MailConfiguration from pp_admintools.mail_config ...") - from pp_admintools.mail_config import MailConfiguration # noqa + LOG.info("Testing import of MailConfiguration from pp_admintools.config.mail ...") + from pp_admintools.config.mail import MailConfiguration # noqa # ------------------------------------------------------------------------- def test_object(self): LOG.info("Testing init of a MailConfiguration object.") - from pp_admintools.mail_config import MailConfiguration + from pp_admintools.config.mail import MailConfiguration cfg = MailConfiguration( appname=self.appname, diff --git a/test/test_06_ldapcfg.py b/test/test_06_ldapcfg.py index 5704de8..b8ae32a 100755 --- a/test/test_06_ldapcfg.py +++ b/test/test_06_ldapcfg.py @@ -26,7 +26,7 @@ sys.path.insert(0, libdir) from general import PpAdminToolsTestcase, get_arg_verbose, init_root_logger -from fb_tools.common import pp, to_str, is_sequence +# from fb_tools.common import pp, to_str, is_sequence LOG = logging.getLogger('test-ldapcfg') @@ -50,26 +50,26 @@ class TestLdapConfig(PpAdminToolsTestcase): # ------------------------------------------------------------------------- def test_import(self): - LOG.info("Testing import of pp_admintools.ldap_config ...") - import pp_admintools.ldap_config + LOG.info("Testing import of pp_admintools.config.ldap ...") + import pp_admintools.config.ldap LOG.debug( - "Version of pp_admintools.ldap_config: " + pp_admintools.ldap_config.__version__) + "Version of pp_admintools.config.ldap: " + pp_admintools.config.ldap.__version__) - LOG.info("Testing import of LdapConfigError from pp_admintools.ldap_config ...") - from pp_admintools.ldap_config import LdapConfigError # noqa + LOG.info("Testing import of LdapConfigError from pp_admintools.config.ldap ...") + from pp_admintools.config.ldap import LdapConfigError # noqa - LOG.info("Testing import of LdapConnectionInfo from pp_admintools.ldap_config ...") - from pp_admintools.ldap_config import LdapConnectionInfo # noqa + LOG.info("Testing import of LdapConnectionInfo from pp_admintools.config.ldap ...") + from pp_admintools.config.ldap import LdapConnectionInfo # noqa - LOG.info("Testing import of LdapConfiguration from pp_admintools.ldap_config ...") - from pp_admintools.ldap_config import LdapConfiguration # noqa + LOG.info("Testing import of LdapConfiguration from pp_admintools.config.ldap ...") + from pp_admintools.config.ldap import LdapConfiguration # noqa # ------------------------------------------------------------------------- def test_object(self): LOG.info("Testing init of a LdapConfiguration object.") - from pp_admintools.ldap_config import LdapConfiguration + from pp_admintools.config.ldap import LdapConfiguration cfg = LdapConfiguration( appname=self.appname, -- 2.39.5