Skip to content

Commit fc16700

Browse files
committed
run generate pip deps from conda on all conda env files
1 parent e59a962 commit fc16700

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

scripts/generate_pip_deps_from_conda.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232

3333
"""
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
3535
3636
This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
3737
You can run it manually with `pre-commit run pip-to-conda --all`.
3838
"""
39-
import os
39+
import argparse
4040
import re
4141

4242
import yaml
@@ -113,10 +113,9 @@ def main(conda_fname, pip_fname):
113113
else:
114114
raise ValueError(f"Unexpected dependency {dep}")
115115

116-
fname = os.path.split(conda_fname)[1]
117116
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"
120119
)
121120
pip_content = header + "\n".join(pip_deps) + "\n"
122121

@@ -125,7 +124,11 @@ def main(conda_fname, pip_fname):
125124

126125

127126
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

Comments
 (0)