Skip to content

Commit

Permalink
path copy and pasteos
Browse files Browse the repository at this point in the history
  • Loading branch information
dnil committed Oct 24, 2024
1 parent a082d47 commit e5424b0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
except ImportError:
from distutils.core import setup

def parse_reqs(req_path="./requirements.txt"):
here = os.path.join(os.path.abspath(os.path.dirname(__file__)))

def parse_reqs(req_path = "requirements.txt"):
"""Recursively parse requirements from nested pip files."""
install_requires = []
with io.open(os.path.join(os.path.abspath(os.path.dirname(__file__)), "requirements.txt"), encoding="utf-8") as handle:
with io.open(os.path.join(here, req_path), encoding="utf-8") as handle:
# remove comments and empty lines
lines = (line.strip() for line in handle if line.strip() and not line.startswith("#"))

Expand All @@ -19,15 +21,14 @@ def parse_reqs(req_path="./requirements.txt"):
if line.startswith("-r"):
# recursively call this function
install_requires += parse_reqs(req_path=line[3:])

else:
# add the line as a new requirement
install_requires.append(line)

return install_requires

about = {}
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), "genmod", "__version__.py")) as f:
with open(os.path.join(here, "genmod/__version__.py")) as f:
exec(f.read(), about)

# What packages are required for this module to be executed?
Expand Down

0 comments on commit e5424b0

Please sign in to comment.