python-wheel-build / fromager

Build your own wheels
https://fromager.readthedocs.io/en/latest/
Apache License 2.0
7 stars 11 forks source link

validate whether downloaded wheel is valid or not #512

Closed shubhbapna closed 5 hours ago

shubhbapna commented 4 days ago

In _download_wheel_check we currently just check whether the wheel file is a valid zip file. Lets instead check if it is a valid wheel file by using the wheel.wheelfile.WheelFile API as mentioned in https://github.com/python-wheel-build/fromager/issues/507#issuecomment-2492133631

shubhbapna commented 3 days ago

@tiran using wheel.wheelfile.WheelFile(wheel_filename) doesn't work. It throws an error says wheelfile is not an attribute of wheel

tiran commented 3 days ago

You have to import the submodule:

>>> import wheel
>>> wheel.wheelfile.WheelFile
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'wheel' has no attribute 'wheelfile'
>>> import wheel.wheelfile
>>> wheel.wheelfile.WheelFile
<class 'wheel.wheelfile.WheelFile'>