Make `.egg-info` filename parsing spec compliant (#4533)
## Summary
It turns out that `.egg-info` files and directories can _both_ have up
to four segments in the filename:
https://setuptools.pypa.io/en/latest/deprecated/python_eggs.html#filename-embedded-metadata.
This PR upgrades the parsing and now uses the same parsing for files and
directories.
Closes https://github.com/astral-sh/uv/issues/4532.