Created
September 5, 2013 09:50
-
-
Save msiemens/6448117 to your computer and use it in GitHub Desktop.
setup.py: Load requires from requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from pip.req import parse_requirements | |
except ImportError: | |
def requirements(f): | |
reqs = open(f, 'r').read().splitlines() | |
reqs = [r for r in reqs if not r.strip().startswith('#')] | |
return reqs | |
else: | |
def requirements(f): | |
install_reqs = parse_requirements(f) | |
reqs = [str(r.req) for r in install_reqs] | |
return reqs | |
# ... | |
install_requires = requirements('requirements.txt') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment