NEW 263589
[AutoInstall] Handle namespaces packages
https://bugs.webkit.org/show_bug.cgi?id=263589
Summary [AutoInstall] Handle namespaces packages
Jonathan Bedard
Reported 2023-10-24 08:07:56 PDT
Currently, AutoInstall does not handle namespace packages (as documented by Python here https://packaging.python.org/en/latest/guides/packaging-namespace-packages/) well. This is because AutoInstall expects the package name to be a folder, and deletes the entire folder when uninstalling a package. This means that AutoInstall can't handle using two namespace packages which share a common parent package. Although we've been able to work around this issue with `aliases` so far, we should have autoinstall correctly handle this situation.
Attachments
Radar WebKit Bug Importer
Comment 1 2023-10-31 08:08:21 PDT
Sam Sneddon [:gsnedders]
Comment 2 2024-12-04 13:13:51 PST
https://commits.webkit.org/230559@main added aliases in the form of: AutoInstall.register(Package('logilab.common', Version(0, 58, 1), pypi_name='logilab-common', aliases=['logilab'])) AutoInstall.register(Package('logilab.astng', Version(0, 24, 1), pypi_name='logilab-astng', aliases=['logilab'])) AutoInstall.register(Package('zope.interface', Version(5, 1, 0), aliases=['zope'], pypi_name='zope-interface')) Looking at the first two, given they are the two with the same alias, they both install: logilab/__init__.py,sha256=BoTPhN0fnF0LnrjGUZovSHBQUocVZx9TupGxudXvSvg,155 …which will, of course, work fine, even if we overwrite it. We do also delete the directory we believe we're installing into, which for logilab.common is autoinstalled_dir/logilab/common, but we don't actually verify that we only install into that directory. However, https://commits.webkit.org/228060@main added support for wheels in a way that is significantly more broken with namespace packages: When we install a wheel, we look at what top-level directories we find within the wheel, and if they already exist, we delete them. This means that if logilab.common had installed logilab/common, and then logilab.astng got installed, we'd delete logilab/ before proceeding to install it. Really what we should do better at is uninstalling old versions of packages before installing new ones, but maybe in the short-term we should hack around this by making the behaviour the same regardless of whether we're using the legacy dist/setuptools install or installing from a wheel?
Sam Sneddon [:gsnedders]
Comment 3 2024-12-04 15:36:12 PST
Bug 263392 is about deleting things, which is probably the majority of the problem here?
Note You need to log in before you can comment on or make changes to this bug.