Skip to content

Commit 025277d

Browse files
committed
Use self.log.warning instead of warnings.warn
warnings.warn sidesteps all the json logging bits we do, and repo2docker will produce non-json output that binderhub then struggles to consume.
1 parent b7c1515 commit 025277d

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

repo2docker/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def _platform_default(self):
267267
"""
268268
p = get_platform()
269269
if p == "linux/arm64":
270-
warnings.warn(
270+
self.log.warning(
271271
"Building for linux/arm64 is experimental. "
272272
"To use the recommended platform set --Repo2Docker.platform=linux/amd64. "
273273
"To silence this warning set --Repo2Docker.platform=linux/arm64."

repo2docker/buildpacks/conda/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def uses_r(self):
355355
@property
356356
def py2(self):
357357
"""Am I building a Python 2 kernel environment?"""
358-
warnings.warn(
358+
self.log.warning(
359359
"CondaBuildPack.py2 is deprecated in 2023.2. Use CondaBuildPack.separate_kernel_env.",
360360
DeprecationWarning,
361361
stacklevel=2,

repo2docker/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,5 +543,4 @@ def get_platform():
543543
# OSX reports arm64
544544
return "linux/arm64"
545545
else:
546-
warnings.warn(f"Unexpected platform '{m}', defaulting to linux/amd64")
547-
return "linux/amd64"
546+
raise ValueError("Unsupported platform {m}")

0 commit comments

Comments
 (0)