From e66fd034bdea1461a9deb6dd00e8e60ce464134f Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 6 Mar 2020 22:57:41 +0000 Subject: Set content type of readme --- setup.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 885a5f9..503cc45 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import io import os from distutils.command.sdist import sdist @@ -322,6 +323,10 @@ def check_requirements(): raise ImportError(numpy_instructions) +class mysdist(sdist): + READMES = ("README", "README.txt", "README.rst", "README.md") + + if __name__ == "__main__": check_requirements() @@ -334,12 +339,18 @@ if __name__ == "__main__": else: about["__version__"] = VERSION + try: + with io.open(os.path.join(here, "README.md"), encoding="utf-8") as fp: + long_description = "\n" + fp.read() + except FileNotFoundError: + long_description = DESCRIPTION + attr = configuration().todict() attr["version"] = about["__version__"] attr["description"] = DESCRIPTION - attr["long_description"] = read("README.md") - attr["long_description"] = "text/markdown" + attr["long_description"] = long_description + attr["long_description_content_type"] = "text/markdown" attr["packages"] = [NAME] attr["url"] = URL attr["author"] = AUTHOR @@ -347,7 +358,7 @@ if __name__ == "__main__": attr["license"] = LICENSE attr["install_requires"] = REQUIRED attr["extras_require"] = EXTRAS - attr["cmdclass"] = {"sdist": sdist} + attr["cmdclass"] = {"sdist": mysdist} from numpy.distutils.core import setup -- cgit v1.2.3