|
18 | 18 | pass
|
19 | 19 |
|
20 | 20 | # Define the list of requirements with specified versions
|
21 |
| -requirements = [ |
22 |
| - # Still needing future for the CarbonIFace lib and some other stuff (queues, ...) |
23 |
| - # Needing six for python 2.7/3 compatibility |
24 |
| - 'future==0.16.0', |
25 |
| - 'six==1.11.0', |
26 |
| - |
27 |
| - # Alignak supports the most recent CherryPy |
28 |
| - 'CherryPy==15.0.0', |
29 |
| - |
30 |
| - # Requests to communicate between the daemons |
31 |
| - 'requests==2.18.4', |
32 |
| - |
33 |
| - # importlib is used to import modules used by the daemons |
34 |
| - 'importlib' if sys.version_info <= (2,7) else '', |
35 |
| - |
36 |
| - # Colored console log |
37 |
| - 'termcolor==1.1.0', |
38 |
| - |
39 |
| - # Set process titles |
40 |
| - 'setproctitle==1.1.10', |
41 |
| - |
42 |
| - # ujson is used for the internal objects serialization |
43 |
| - 'ujson==1.35', |
44 |
| - |
45 |
| - # numpy for date and percentile computation - needs a compiler on the installation target system! |
46 |
| - # Comment to use an internal implementation of percentile function |
47 |
| - 'numpy==1.14.3', |
48 |
| - |
49 |
| - # SSL between the daemons |
50 |
| - # This requirement is only a requirement if you intend to use SLL for the inter-daemons |
51 |
| - # communication. As such, to avoid installing this library per default, commenting this line! |
52 |
| - # Uncomment or `pip install pyopenssl` if SSL must be used between the Alignak daemons |
53 |
| - # pyopenssl |
54 |
| - |
55 |
| - # configparser is used to parse command line of the daemons |
56 |
| - 'configparser' if sys.version_info <= (2,7) else '', |
57 |
| - # docopt is used by the alignak_environment script |
58 |
| - 'docopt==0.6.2', |
59 |
| - |
60 |
| - # Use psutil for daemons memory monitoring (env ALIGNAK_DAEMONS_MONITORING) |
61 |
| - # Use psutil for scheduler ALIGNAK_LOG_MONITORING |
62 |
| - # Use psutil for launching daemons from the Arbiter |
63 |
| - 'psutil==5.4.5' |
64 |
| -] |
| 21 | +def read_requirements(filename='requirements.txt'): |
| 22 | + """Reads the list of requirements from given file. |
| 23 | +
|
| 24 | + :param filename: Filename to read the requirements from. |
| 25 | + Uses ``'requirements.txt'`` by default. |
| 26 | +
|
| 27 | + :return: Requirments as list of strings. |
| 28 | + """ |
| 29 | + # allow for some leeway with the argument |
| 30 | + if not filename.startswith('requirements'): |
| 31 | + filename = 'requirements-' + filename |
| 32 | + if not os.path.splitext(filename)[1]: |
| 33 | + filename += '.txt' # no extension, add default |
| 34 | + |
| 35 | + def valid_line(line): |
| 36 | + line = line.strip() |
| 37 | + return line and not any(line.startswith(p) for p in ('#', '-')) |
| 38 | + |
| 39 | + def extract_requirement(line): |
| 40 | + egg_eq = '#egg=' |
| 41 | + if egg_eq in line: |
| 42 | + _, requirement = line.split(egg_eq, 1) |
| 43 | + return requirement |
| 44 | + return line |
| 45 | + |
| 46 | + with open(filename) as f: |
| 47 | + lines = f.readlines() |
| 48 | + return list(map(extract_requirement, filter(valid_line, lines))) |
| 49 | +requirements = read_requirements() |
| 50 | +print(requirements) |
| 51 | +# exit() |
65 | 52 |
|
66 | 53 | # Better to use exec to load the VERSION from alignak/version.py
|
67 | 54 | # so to not have to import the alignak package:
|
|
138 | 125 | zip_safe=False,
|
139 | 126 | platforms='any',
|
140 | 127 |
|
141 |
| - # Dependencies (if some) ... |
142 |
| - install_requires=[ |
143 |
| - # Do not set specific versions - for development purposes, use the most recent versions |
144 |
| - # More about this: https://packaging.python.org/discussions/ |
145 |
| - # install-requires-vs-requirements/#install-requires-vs-requirements-files |
146 |
| - 'future', |
147 |
| - 'six', |
148 |
| - 'importlib' if sys.version_info <= (2,7) else '', |
149 |
| - 'CherryPy', |
150 |
| - 'requests', |
151 |
| - 'termcolor', |
152 |
| - 'setproctitle', |
153 |
| - 'ujson', |
154 |
| - 'numpy', |
155 |
| - 'docopt', |
156 |
| - 'psutil' |
157 |
| - ], |
| 128 | + # Dependencies... |
| 129 | + install_requires=requirements, |
158 | 130 | dependency_links=[
|
159 | 131 | # Use the standard PyPi repository
|
160 | 132 | "https://pypi.python.org/simple/",
|
|
0 commit comments