Skip to content

RECORD file is broken if strip_path_prefixes used #745

@ppodolsky

Description

@ppodolsky

Hi! Following rule

py_wheel(
    ...
    strip_path_prefixes = ["prefix"],
)

creates wheel with RECORD file containing following records:

/blabla/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
/blabla/language_detect.py,sha256=RTufRn4WInDHn_5W4CThkFp6RV0ZYaserNa1rBLJJ-s,445
/blabla/morph.py,sha256=54gzoFL3oJQWq-cKuhJfXojEOU6Knw0ZR4peX8u7zaY,845
/blabla/regex.py,sha256=LqhF6JmKWihvi02XIFMFZOvmzqMxyixIUl1aaYn0BkQ,1488
/blabla/utils.py,sha256=kYW4zrRvksvXzardHjlZgwOLCPJrfVjG72k-gmIqzf4,2726
package-1.0.4.dist-info/METADATA,sha256=ogEnrEFMwzwSuA9V_uCzMViGbgnxb-UQDHLatLVBUgM,462
package-1.0.4.dist-info/RECORD,,
package-1.0.4.dist-info/WHEEL,sha256=sobxWSyDDkdg_rinUth-jxhXHqoNqlmNMJY3aTZn2Us,91

The issue is that remaining leading slash in first files break the package. If you will try to install such wheel with requirement it failes at
https://github.com/pypa/installer/blob/main/src/installer/sources.py#L158
The solution is to merely lstrip this slash for every line in RECORD

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions