-
Notifications
You must be signed in to change notification settings - Fork 14
cleanup: fix typing in command/build.py #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanup: fix typing in command/build.py #249
Conversation
src/fromager/wheels.py
Outdated
@@ -111,7 +111,7 @@ def build_wheel( | |||
wheels = list(ctx.wheels_build.glob("*.whl")) | |||
if wheels: | |||
return wheels[0] | |||
return None | |||
raise FileNotFoundError(f"Could not locate the built wheels for {req.name}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhellmann from what I noticed wherever this function is called, the caller already expects a non null return value. Do you think if we raise an error instead of returning null it would be fine? Or would you rather make this change later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that separately so we can focus on test coverage for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay then I will fix the type errors from this separately
src/fromager/wheels.py
Outdated
@@ -111,7 +111,7 @@ def build_wheel( | |||
wheels = list(ctx.wheels_build.glob("*.whl")) | |||
if wheels: | |||
return wheels[0] | |||
return None | |||
raise FileNotFoundError(f"Could not locate the built wheels for {req.name}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The signature of the exception class is a bit obscure. It takes an errno number, error string, and file or target name:
raise FileNotFoundError(f"Could not locate the built wheels for {req.name}") | |
raise FileNotFoundError(errno.ENOENT, "Could not locate the built wheels for", req.name) |
>>> import errno
>>> from packaging.requirements import Requirement
>>> req = Requirement("egg==0.1")
>>> raise FileNotFoundError(errno.ENOENT, "Could not locate the built wheels for", req.name)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] Could not locate the built wheels for: 'egg'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the exception call
Will be adding the exception call in a separate PR. Have noted this down |
53a1d71
to
56c042b
Compare
927747f
to
7d147cb
Compare
part of #226
fixes