|
| 1 | +from collections import defaultdict |
| 2 | +import os |
| 3 | +import pathlib |
1 | 4 | from setuptools import setup
|
2 | 5 |
|
3 |
| -# Read in the requirements.txt file |
4 |
| -with open("requirements.txt") as f: |
5 |
| - requirements = [] |
6 |
| - for library in f.read().splitlines(): |
7 |
| - if "hypothesis" not in library: # Skip: used only for dev |
8 |
| - requirements.append(library) |
| 6 | +# Read in the requirements files. |
| 7 | +requirements = defaultdict(list) |
| 8 | + |
| 9 | +requirements_directory = pathlib.Path.cwd() / "requirements" |
| 10 | +for filename in requirements_directory.glob("*.txt"): |
| 11 | + variant = filename.stem |
| 12 | + with filename.open() as libraries: |
| 13 | + for library in libraries: |
| 14 | + if len(library) > 0 and (not library.startswith("-r")): |
| 15 | + requirements[variant].append(library.strip()) |
| 16 | + |
| 17 | +# Grab the default requirements |
| 18 | +install_requires = requirements["requirements"] |
| 19 | +# Delete the default from the dictionary for the extra variants. |
| 20 | +del requirements["requirements"] |
| 21 | +extras_require = dict(requirements) |
9 | 22 |
|
10 | 23 | # Read in long description
|
11 | 24 | with open("README.rst", "r") as f:
|
|
17 | 30 | setup(
|
18 | 31 | name="Axelrod",
|
19 | 32 | version=__version__,
|
20 |
| - install_requires=requirements, |
| 33 | + install_requires=install_requires, |
21 | 34 | author="Vince Knight, Owen Campbell, Karol Langner, Marc Harper",
|
22 | 35 | author_email=( "[email protected]"),
|
23 | 36 | packages=["axelrod", "axelrod.strategies", "axelrod.data"],
|
|
35 | 48 | "Programming Language :: Python :: 3 :: Only",
|
36 | 49 | ],
|
37 | 50 | python_requires=">=3.6",
|
| 51 | + extras_require=extras_require, |
38 | 52 | )
|
0 commit comments