diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-08-30 18:07:40 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-08-30 18:09:07 +0200 |
commit | ed0b01dd362f2def142cf2128aac844f09ee4fdc (patch) | |
tree | 6561049cccb54618825db06a1b4d43c2304f5c94 | |
parent | cecb1df56dbc8ead811b155c4268ccad1c0b82f1 (diff) | |
download | hyperkitty-ed0b01dd362f2def142cf2128aac844f09ee4fdc.tar.gz hyperkitty-ed0b01dd362f2def142cf2128aac844f09ee4fdc.tar.xz hyperkitty-ed0b01dd362f2def142cf2128aac844f09ee4fdc.zip |
Strip pip syntax from the requirements file
-rwxr-xr-x | setup.py | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -6,16 +6,19 @@ use_setuptools() from setuptools import setup, find_packages -def filetolist(filepath): +def reqfile(filepath): """Turns a text file into a list (one element per line)""" result = [] + import re + url_re = re.compile(".+:.+#egg=(.+)") with open(filepath, "r") as f: for line in f: - if "#" in line: - line = line[:line.index("#")] line = line.strip() - if not line: + if not line or line.startswith("#"): continue + mo = url_re.match(line) + if mo is not None: + line = mo.group(1) result.append(line) return result @@ -41,5 +44,5 @@ setup( #packages=find_packages(exclude=["*.test", "test", "*.test.*"]), packages=find_packages(), include_package_data=True, - install_requires=filetolist('requirements.txt'), + install_requires=reqfile("requirements.txt"), ) |