Skip to content

Commit 020160b

Browse files
authored
Merge pull request #1106 from manics/freeze.py--help
2 parents 4aa1d15 + 62c0de2 commit 020160b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

repo2docker/buildpacks/conda/freeze.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
python freeze.py [3.8]
1010
"""
1111

12+
from argparse import ArgumentParser
1213
from datetime import datetime
1314
import os
1415
import pathlib
@@ -106,10 +107,21 @@ def set_python(py_env_file, py):
106107

107108

108109
if __name__ == "__main__":
109-
# allow specifying which Pythons to update on argv
110-
pys = sys.argv[1:] or ("2.7", "3.6", "3.7", "3.8", "3.9")
110+
parser = ArgumentParser(
111+
description=(
112+
"Refreeze conda environments. See "
113+
"https://repo2docker.readthedocs.io/en/latest/contributing/tasks.html#update-and-freeze-buildpack-dependencies"
114+
)
115+
)
116+
parser.add_argument(
117+
"py",
118+
nargs="*",
119+
help="Python version(s) to update and freeze",
120+
default=("2.7", "3.6", "3.7", "3.8", "3.9"),
121+
)
122+
args = parser.parse_args()
111123
default_py = "3.7"
112-
for py in pys:
124+
for py in args.py:
113125
env_file = pathlib.Path(str(ENV_FILE_T).format(py=py))
114126
set_python(env_file, py)
115127
frozen_file = pathlib.Path(os.path.splitext(env_file)[0] + ".lock")

0 commit comments

Comments
 (0)