FMPy icon indicating copy to clipboard operation
FMPy copied to clipboard

Invalid wheels

Open radoering opened this issue 1 year ago • 1 comments

The latest wheel provided on PyPI is not valid because it contains files that are not listed in the wheel's RECORD file.

According to the PyPA specification for wheels:

RECORD is a list of (almost) all the files in the wheel and their secure hashes. Unlike PEP 376, every file except RECORD, which cannot contain a hash of itself, must include its hash.

installation will fail if any file in the archive is not both mentioned and correctly hashed in RECORD

It's fortunate that pip doesn't seem to be adhering to the specification yet.

Steps to verify:

$ python3 -m venv .venv
$ . .venv/bin/activate
(.venv) $ pip install installer
(.venv) $ curl https://files.pythonhosted.org/packages/b2/b6/fb4cbc6e8437a8722fd70cff8d31a32750ae14fe1e5b0174873907bff074/FMPy-0.3.15-py3-none-any.whl -o FMPy-0.3.15-py3-none-any.
whl
(.venv) $ python
>>> from installer.sources import WheelFile, _WheelFileValidationError
>>> from pprint import pprint
>>> with WheelFile.open("FMPy-0.3.15-py3-none-any.whl") as source:
...     try:
...         source.validate_record()
...     except _WheelFileValidationError as e:
...         pprint(e.issues, width=200)
...
['In FMPy-0.3.15-py3-none-any.whl, fmpy/sundials/x86_64-linux/sundials_sunmatrixdense.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/sundials/x86_64-linux/sundials_sunlinsoldense.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/sundials/x86_64-linux/sundials_cvode.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/sundials/x86_64-linux/sundials_nvecserial.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/sundials/x86_64-darwin/sundials_nvecserial.dylib is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/sundials/x86_64-darwin/sundials_sunlinsoldense.dylib is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/sundials/x86_64-darwin/sundials_sunmatrixdense.dylib is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/sundials/x86_64-darwin/sundials_cvode.dylib is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/cswrapper/cswrapper.dylib is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/cswrapper/cswrapper.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/remoting/linux64/server_tcp is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/remoting/linux64/client_tcp.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/logging/linux64/logging.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/logging/darwin64/logging.dylib is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/modelica/FMI/Resources/Library/linux64/ModelicaFMI.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/modelica/FMI/Resources/Library/darwin64/ModelicaFMI.dylib is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/fmucontainer/binaries/linux64/FMUContainer.so is not mentioned in RECORD',
 'In FMPy-0.3.15-py3-none-any.whl, fmpy/fmucontainer/binaries/darwin64/FMUContainer.dylib is not mentioned in RECORD']

I haven't tried yet to find out why these files are not contained in the RECORD. Maybe someone has an idea?

radoering avatar Mar 19 '23 16:03 radoering

OK, the reason is simple: https://github.com/CATIA-Systems/FMPy/blob/1d74126039d6ae861df86110b423c068d5085b7d/azure-pipelines.yml#L220-L226

It's just the RECORD file from a Windows wheel.

Instead of zipping the merged directory, running wheel pack should do.

radoering avatar Mar 19 '23 19:03 radoering

Solved with c97ad023ec6bce96fe2efa5aeb4427a688b346bc.

t-sommer avatar Mar 26 '24 09:03 t-sommer