Skip to content

Commit 190bcca

Browse files
committed
Update setup.py for possibly empty requirements
1 parent abf1497 commit 190bcca

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

setup.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,29 @@ def run(self):
5151
raise SystemExit(report.total_errors > 0)
5252

5353

54-
with open("README.md", "r") as fh:
55-
long_description = fh.read()
54+
def long_description():
55+
# check if README.md exists
56+
if not os.path.exists("README.md"):
57+
return ""
58+
with open("README.md", "r") as fh:
59+
return fh.read()
60+
61+
62+
def requirements():
63+
# check if requirements.txt exists
64+
if not os.path.exists("requirements.txt"):
65+
return []
66+
with open("requirements.txt") as f:
67+
return f.read().splitlines()
5668

57-
with open("requirements.txt") as fh:
58-
requirements = fh.read().split("\n")
5969

6070
setup(
6171
name="table2ascii",
62-
version="0.1.1",
72+
version="0.1.2",
6373
author="Jonah Lawrence",
6474
author_email="[email protected]",
6575
description="Convert 2D Python lists into Unicode/Ascii tables",
66-
long_description=long_description,
76+
long_description=long_description(),
6777
long_description_content_type="text/markdown",
6878
url="https://github.com/DenverCoder1/table2ascii",
6979
project_urls={
@@ -78,7 +88,7 @@ def run(self):
7888
"Topic :: Utilities",
7989
],
8090
python_requires=">=3.6",
81-
install_requires=[requirements],
91+
install_requires=[requirements()],
8292
setup_requires=[
8393
"flake8>=3.8,<4",
8494
],

0 commit comments

Comments
 (0)