Bug 263589
| Summary: | [AutoInstall] Handle namespaces packages | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jonathan Bedard <jbedard> |
| Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: |
https://bugs.webkit.org/show_bug.cgi?id=264703 https://bugs.webkit.org/show_bug.cgi?id=263392 |
||
Jonathan Bedard
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/117742039>
Sam Sneddon [:gsnedders]
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]
Bug 263392 is about deleting things, which is probably the majority of the problem here?