From dd8ead6e4e9506043ec629928e816a987d91158e Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Fri, 12 Feb 2021 20:07:20 +0200 Subject: [PATCH] Use the module docstring as the package description. Workaround missing imported packages in some cases (like pre-commit) so the module can still be imported. --- check_s3_bucket/__init__.py | 19 ++++++++++++++----- setup.py | 4 ++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/check_s3_bucket/__init__.py b/check_s3_bucket/__init__.py index 368e067..e258ce2 100755 --- a/check_s3_bucket/__init__.py +++ b/check_s3_bucket/__init__.py @@ -15,16 +15,13 @@ try: import botocore.session import botocore.exceptions except ImportError: - print("Failed to import botocore.") - sys.exit(3) + pass try: import pytz except ImportError: - print("Failed to import pytz.") - sys.exit(3) + pass __version__ = "0.2.6" -NOW = datetime.datetime.now(pytz.utc) def get_file_list(conn, bucket, prefix=""): @@ -160,4 +157,16 @@ def main(): # noqa: C901 if __name__ == "__main__": + if "botocore" not in dir(): + print( + "Failed to import botocore, is the package installed?", + file=sys.stderr, + ) + sys.exit(3) + if "pytz" not in dir(): + print( + "Failed to import pytz, is the package installed?", file=sys.stderr + ) + sys.exit(3) + NOW = datetime.datetime.now(pytz.utc) main() diff --git a/setup.py b/setup.py index 4bf307c..c26ccca 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,12 @@ #!/usr/bin/env python # pylint: disable=missing-docstring from setuptools import setup, find_packages +from check_s3_bucket import __doc__ as description setup( name="check_s3_bucket", version="0.2.6", - description="""Check that a file was added to an S3 bucket in the given - time window and is of a reasonable size.""", + description=description, long_description=open("README.rst", "r").read(), url="https://git.shore.co.il/nimrod/check_s3_bucket", author="Nimrod Adar", -- GitLab