Skip to content

Commit 653b96d

Browse files
Fix: Add error handling for README and requirements file loading in setup.py
1 parent 2ee2448 commit 653b96d

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

setup.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
from setuptools import setup, find_packages
22

33
# Read the long description from README.md
4-
with open("README.md", "r", encoding="utf-8") as fh:
5-
long_description = fh.read()
4+
try:
5+
with open("README.md", "r", encoding="utf-8") as fh:
6+
long_description = fh.read()
7+
except FileNotFoundError:
8+
long_description = (
9+
"A simple command-line tool to count lines in files by extension. "
10+
"See the documentation for more details."
11+
)
612

713
# Read the list of requirements from requirements.txt
8-
with open("requirements.txt", "r", encoding="utf-8") as fh:
9-
requirements = fh.read().splitlines()
14+
try:
15+
with open("requirements.txt", "r", encoding="utf-8") as fh:
16+
requirements = fh.read().splitlines()
17+
except FileNotFoundError:
18+
requirements = ["tabulate==0.9.0"]
1019

1120
setup(
1221
name="extliner",

0 commit comments

Comments
 (0)