Browse Source

setup.py: replace Path.read_text() to restore compatibility with python3.4

Fabian Peter Hammerle 4 years ago
parent
commit
7b7ac73fcb
1 changed files with 8 additions and 1 deletions
  1. 8 1
      setup.py

+ 8 - 1
setup.py

@@ -2,12 +2,19 @@ import pathlib
 
 import setuptools
 
+
+def _read_text(path: pathlib.Path) -> str:
+    with path.open("r") as file:
+        return file.read()
+
+
 setuptools.setup(
     name="free-disk",
     use_scm_version=True,
     description="delete file with oldest modification date"
     " until a minimum of --free-bytes are available on disk",
-    long_description=pathlib.Path(__file__).parent.joinpath("README.md").read_text(),
+    # Path.read_text() new in python v3.5
+    long_description=_read_text(pathlib.Path(__file__).parent.joinpath("README.md")),
     long_description_content_type="text/markdown",
     author="Fabian Peter Hammerle",
     author_email="fabian@hammerle.me",