Bug 2115906 - mercurial does not own /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py3.11.egg-info
Summary: mercurial does not own /usr/lib64/python3.11/site-packages/mercurial-6.2.1-py...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mercurial
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Mads Kiilerich
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-05 16:27 UTC by Miro Hrončok
Modified: 2023-05-03 09:05 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-05-03 09:05:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 2115001 0 unspecified CLOSED pip will not install packages, errors out when an empty egg-info/dist-info is present 2023-02-10 16:35:15 UTC

Internal Links: 2115001

Description Miro Hrončok 2022-08-05 16:27:21 UTC
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.

Comment 1 Mads Kiilerich 2022-08-06 17:45:59 UTC
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?

Comment 2 Miro Hrončok 2022-08-06 17:55:58 UTC
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

Comment 3 Mads Kiilerich 2022-08-06 18:14:21 UTC
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.)

Comment 4 Miro Hrončok 2022-08-06 19:48:37 UTC
> 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.

Comment 5 Mads Kiilerich 2022-08-06 20:33:57 UTC
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.

Comment 6 Ben Cotton 2022-08-09 13:42:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.


Note You need to log in before you can comment on or make changes to this bug.