From 27ac139138d455375c18f934234e33859fec2664 Mon Sep 17 00:00:00 2001 From: rajeshwariramya <103486631+rajeshwariramya@users.noreply.github.com> Date: Sat, 19 Oct 2024 06:31:19 +0530 Subject: [PATCH] Update setup.py --- setup.py | 53 ++++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/setup.py b/setup.py index c640f65..2f5fcf4 100644 --- a/setup.py +++ b/setup.py @@ -5,26 +5,26 @@ from codecs import open from setuptools import setup, find_packages - -def get_long_description(title): +def get_long_description(title: str) -> str: """Create the long_description from other files.""" ROOT = os.path.abspath(os.path.dirname(__file__)) - readme = open(os.path.join(ROOT, "README.rst"), "r", "utf8").read() - body_tag = ".. Omit badges from docs" - readme_body_start = readme.index(body_tag) - assert readme_body_start - readme_body = readme[readme_body_start + len(body_tag) :] + try: + readme = open(os.path.join(ROOT, "README.rst"), "r", "utf8").read() + body_tag = ".. Omit badges from docs" + readme_body_start = readme.index(body_tag) + assert readme_body_start + readme_body = readme[readme_body_start + len(body_tag) :] - changelog = open(os.path.join(ROOT, "changelog.rst"), "r", "utf8").read() - old_tag = ".. Omit older changes from package" - changelog_body_end = changelog.index(old_tag) - assert changelog_body_end - changelog_body = changelog[:changelog_body_end] + changelog = open(os.path.join(ROOT, "changelog.rst"), "r", "utf8").read() + old_tag = ".. Omit older changes from package" + changelog_body_end = changelog.index(old_tag) + assert changelog_body_end + changelog_body = changelog[:changelog_body_end] - bars = "=" * len(title) - long_description = ( - """ + bars = "=" * len(title) + long_description = ( + """ %(bars)s %(title)s %(bars)s @@ -34,10 +34,15 @@ def get_long_description(title): _(Older changes can be found in the full documentation)._ """ - % locals() - ) - return long_description - + % locals() + ) + return long_description + except FileNotFoundError as e: + print(f"Error: {e}") + return "" + except Exception as e: + print(f"An error occurred: {e}") + return "" setup( name="django-nose", @@ -56,16 +61,6 @@ def get_long_description(title): zip_safe=False, install_requires=["nose>=1.2.1"], test_suite="testapp.runtests.runtests", - # This blows up tox runs that install django-nose into a virtualenv, - # because it causes Nose to import django_nose.runner before the Django - # settings are initialized, leading to a mess of errors. There's no reason - # we need FixtureBundlingPlugin declared as an entrypoint anyway, since you - # need to be using django-nose to find the it useful, and django-nose knows - # about it intrinsically. - # entry_points=""" - # [nose.plugins.0.10] - # fixture_bundler = django_nose.fixture_bundling:FixtureBundlingPlugin - # """, keywords="django nose django-nose", classifiers=[ "Development Status :: 5 - Production/Stable",