forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert_deps.py
executable file
·31 lines (23 loc) · 978 Bytes
/
convert_deps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
Convert the conda environment.yaml to a pip requirements.txt
"""
import re
import yaml
exclude = {'python=3'}
rename = {'pytables': 'tables'}
with open("ci/environment-dev.yaml") as f:
dev = yaml.load(f)
with open("ci/requirements-optional-conda.txt") as f:
optional = [x.strip() for x in f.readlines()]
required = dev['dependencies']
required = [rename.get(dep, dep) for dep in required if dep not in exclude]
optional = [rename.get(dep, dep) for dep in optional if dep not in exclude]
optional = [re.sub("(?<=[^<>])=", '==', dep) for dep in optional]
with open("ci/requirements_dev.txt", 'wt') as f:
f.write("# This file was autogenerated by scripts/convert_deps.py\n")
f.write("# Do not modify directly\n")
f.write('\n'.join(required))
with open("ci/requirements-optional-pip.txt", 'wt') as f:
f.write("# This file was autogenerated by scripts/convert_deps.py\n")
f.write("# Do not modify directly\n")
f.write("\n".join(optional))