Skip to content

Commit

Permalink
Use self.log.warning instead of warnings.warn
Browse files Browse the repository at this point in the history
warnings.warn sidesteps all the json logging bits we do,
and repo2docker will produce non-json output that binderhub
then struggles to consume.
  • Loading branch information
yuvipanda committed Dec 8, 2024
1 parent 8a6eb6b commit 1ae5a20
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion repo2docker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _platform_default(self):
"""
p = get_platform()
if p == "linux/arm64":
warnings.warn(
self.log.warning(
"Building for linux/arm64 is experimental. "
"To use the recommended platform set --Repo2Docker.platform=linux/amd64. "
"To silence this warning set --Repo2Docker.platform=linux/arm64."
Expand Down
2 changes: 1 addition & 1 deletion repo2docker/buildpacks/conda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def uses_r(self):
@property
def py2(self):
"""Am I building a Python 2 kernel environment?"""
warnings.warn(
self.log.warning(
"CondaBuildPack.py2 is deprecated in 2023.2. Use CondaBuildPack.separate_kernel_env.",
DeprecationWarning,
stacklevel=2,
Expand Down
3 changes: 1 addition & 2 deletions repo2docker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,5 +543,4 @@ def get_platform():
# OSX reports arm64
return "linux/arm64"
else:
warnings.warn(f"Unexpected platform '{m}', defaulting to linux/amd64")
return "linux/amd64"
raise ValueError("Unsupported platform {m}")

0 comments on commit 1ae5a20

Please sign in to comment.