Description of problem: The mercurial package only wons files in /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info but not the directory itself. When mercurial is upgraded or uninstalled, the empty directory remains on disk, confusing some Python packaging code. Please, own the directory. Version-Release number of selected component (if applicable): mercurial-6.2.1-1.fc37 How reproducible: Easy Steps to Reproduce: 1. repoquery --repo=rawhide -l mercurial | grep egg-info Actual results: /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info/PKG-INFO /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info/SOURCES.txt /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info/dependency_links.txt /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info/top_level.txt Expected results: /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info/PKG-INFO /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info/SOURCES.txt /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info/dependency_links.txt /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info/top_level.txt Additional info: See bz2115001.
When building the rawhide package on f36 with python 3.10 (and with hacks to use python 3.11), the egg-info is a file, and it is listed when running setup.py install --record=X.files Do you know why the rawhide / f37 package has egg-info as a directory? Did something change in the python packaging?
A new (rawhide) version of setuptools hijacks the distutils imports when installed. egg-info file is a distutils thing, egg-info directory is a setuptools thing. https://setuptools.pypa.io/en/latest/history.html#v60-0-0
Thanks. Interesting. I would expect Python packaging to improve so it at least would be consistent with the rest of the eco system, and ideally be self-contained. It is sad to see setuptools changing the pure python behaviour. Is this change documented somewhere so I can get a more clear understanding of the problem? (Something in addition to https://github.com/pypa/setuptools/pull/2896 which you linked indirectly.) I conclude that the problem is that setup.py --record only record files, which the Mercurial package use that for %files, and thus has to list directories explicitly. Now there is an additional directory to list. I can fix it for mercurial-6.2.1-py3.11.egg-info in mercurial-6.2.1-2 , but I don't think it is feasible to add hacks to make it clean up after previous versions (such as mercurial-6.2-py3.11.egg-info ). (Especially as the distutils bump only is in rawhide so far.)
> I would expect Python packaging to improve so it at least would be consistent with the rest of the eco system, and ideally be self-contained. I have no idea what you mean here, sorry. Python packaging upstream or Python packaging in Fedora? Consistent with what ecosystem? Self-contained how? mercurial might be converted to use the up-to-date Python packaging guidelines https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/ -- that would not require messing around with --record or similar. I'm happy to help if you are interested. > It is sad to see setuptools changing the pure python behaviour. I agree that setuptools suddenly changing the behavior of projects that don't actually use setuptools is... weird. Do note however that the distutils module is deprecated and going away in Python 3.12. > Is this change documented somewhere... All I know about is the setuptools changelog (Ctrl+f SETUPTOOLS_USE_DISTUTILS). > I conclude that the problem is that setup.py --record only record files, which the Mercurial package use that for %files, and thus has to list directories explicitly. Now there is an additional directory to list. Exactly. Python RECORD files only contain files, not directories. This is documented e.g. in https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file "Directories should not be listed." -- And the --record= option seems to do the same. > I can fix it for mercurial-6.2.1-py3.11.egg-info in mercurial-6.2.1-2 , but I don't think it is feasible to add hacks to make it clean up after previous versions (such as mercurial-6.2-py3.11.egg-info ). (Especially as the distutils bump only is in rawhide so far.) I agree. Don't try to clean up in scriptlets or similar. Just make sure the egg-info is owned. I'll make sure a leftover egg-info won't crash pip.
Thanks. It is fixed in mercurial-6.2.1-2.fc37 https://koji.fedoraproject.org/koji/buildinfo?buildID=2042700 . (In reply to Miro Hrončok from comment #4) > > I would expect Python packaging to improve so it at least would be consistent with the rest of the eco system, and ideally be self-contained. > > I have no idea what you mean here, sorry. I mean for example the divergence that https://packaging.python.org/en/latest/specifications/recording-installed-packages/ says '''Each project installed from a distribution must, in addition to files, install a “.dist-info” directory''', while Python still includes distutil that install a file instead. But ok, that divergence will go away ... > mercurial might be converted to use the up-to-date Python packaging > guidelines https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/ > -- that would not require messing around with --record or similar. I'm happy > to help if you are interested. Yes - the Mercurial packaging uses the --record file to filter files to different sub packages. That is old inherited code and structure that I can clean up - no problem.
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle. Changing version to 37.