Skip to content

Commit e774709

Browse files
committed
Update freeze.py to handle linux-aarch64
1 parent d0d55c0 commit e774709

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

repo2docker/buildpacks/conda/freeze.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
HERE = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
2323

2424
ENV_FILE = HERE / "environment.yml"
25-
FROZEN_FILE = os.path.splitext(ENV_FILE)[0] + ".lock"
25+
FROZEN_FILE_T = os.path.splitext(ENV_FILE)[0] + "-{platform}.lock"
2626

2727
ENV_FILE_T = HERE / "environment.py-{py}.yml"
2828

@@ -119,12 +119,19 @@ def set_python(py_env_file, py):
119119
help="Python version(s) to update and freeze",
120120
default=("3.7", "3.8", "3.9", "3.10"),
121121
)
122+
parser.add_argument(
123+
"platform",
124+
nargs="*",
125+
help="Platform(s) to update and freeze",
126+
default=("linux-64", "linux-aarch64"),
127+
)
122128
args = parser.parse_args()
123129
default_py = "3.7"
124130
for py in args.py:
125-
env_file = pathlib.Path(str(ENV_FILE_T).format(py=py))
126-
set_python(env_file, py)
127-
frozen_file = pathlib.Path(os.path.splitext(env_file)[0] + ".lock")
128-
freeze(env_file, frozen_file)
129-
if py == default_py:
130-
shutil.copy(frozen_file, FROZEN_FILE)
131+
for platform in args.platform:
132+
env_file = pathlib.Path(str(ENV_FILE_T).format(py=py))
133+
set_python(env_file, py)
134+
frozen_file = pathlib.Path(os.path.splitext(env_file)[0] + f"-{platform}.lock")
135+
freeze(env_file, frozen_file, platform)
136+
if py == default_py:
137+
shutil.copy(frozen_file, FROZEN_FILE_T.format(platform=platform))

0 commit comments

Comments
 (0)