31
31
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
32
33
33
"""
34
- Check requirements-dev.txt has been generated from conda-envs/environment-dev-py38 .yml
34
+ Check requirements-dev.txt has been generated from conda-envs/environment-dev-py3* .yml
35
35
36
36
This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
37
37
You can run it manually with `pre-commit run pip-to-conda --all`.
38
38
"""
39
- import os
39
+ import argparse
40
40
import re
41
41
42
42
import yaml
@@ -113,10 +113,9 @@ def main(conda_fname, pip_fname):
113
113
else :
114
114
raise ValueError (f"Unexpected dependency { dep } " )
115
115
116
- fname = os .path .split (conda_fname )[1 ]
117
116
header = (
118
- f"# This file is auto-generated from { fname } , do not modify. \n "
119
- "# See that file for comments about the need/usage of each dependency.\n \n "
117
+ f"# This file is auto-generated from by scripts/generate_pip_deps_from_conda.py, "
118
+ "do not modify. \n # See that file for comments about the need/usage of each dependency.\n \n "
120
119
)
121
120
pip_content = header + "\n " .join (pip_deps ) + "\n "
122
121
@@ -125,7 +124,11 @@ def main(conda_fname, pip_fname):
125
124
126
125
127
126
if __name__ == "__main__" :
128
- main (
129
- os .path .join ("conda-envs" , "environment-dev-py38.yml" ),
130
- "requirements-dev.txt" ,
131
- )
127
+ parser = argparse .ArgumentParser ()
128
+ parser .add_argument ("files" , nargs = "*" )
129
+ args = parser .parse_args ()
130
+ for file in args .files :
131
+ main (
132
+ file ,
133
+ "requirements-dev.txt" ,
134
+ )
0 commit comments