From 14e6401efca3ea0bf62fbdd720e6c5e8f25411ae Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Wed, 20 Nov 2019 14:13:01 -0800 Subject: [PATCH] Create public shim around main and make that the entry point --- certbot/certbot/main.py | 20 ++++++++++++++++++++ certbot/setup.py | 2 +- windows-installer/construct.py | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 certbot/certbot/main.py diff --git a/certbot/certbot/main.py b/certbot/certbot/main.py new file mode 100644 index 000000000..b5b61e5a0 --- /dev/null +++ b/certbot/certbot/main.py @@ -0,0 +1,20 @@ +"""Certbot main public entry point.""" +import logging.handlers +import sys + +from certbot._internal import main as internal_main + + +logger = logging.getLogger(__name__) + + +def main(*args, **kwargs): + """Shim around internal main function""" + return internal_main.main(*args, **kwargs) + + +if __name__ == "__main__": + err_string = main() + if err_string: + logger.warning("Exiting with message %s", err_string) + sys.exit(err_string) # pragma: no cover diff --git a/certbot/setup.py b/certbot/setup.py index ea27acb1f..752b5e39c 100644 --- a/certbot/setup.py +++ b/certbot/setup.py @@ -163,7 +163,7 @@ setup( entry_points={ 'console_scripts': [ - 'certbot = certbot._internal.main:main', + 'certbot = certbot.main:main', ], 'certbot.plugins': [ 'manual = certbot._internal.plugins.manual:Authenticator', diff --git a/windows-installer/construct.py b/windows-installer/construct.py index 089296439..cdf309f13 100644 --- a/windows-installer/construct.py +++ b/windows-installer/construct.py @@ -147,7 +147,7 @@ files=run.bat renew-down.ps1 [Command certbot] -entry_point=certbot._internal.main:main +entry_point=certbot.main:main extra_preamble=pywin32_paths.py '''.format(certbot_version=certbot_version, installer_suffix='win_amd64' if PYTHON_BITNESS == 64 else 'win32',