<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>263589</bug_id>
          
          <creation_ts>2023-10-24 08:07:56 -0700</creation_ts>
          <short_desc>[AutoInstall] Handle namespaces packages</short_desc>
          <delta_ts>2024-12-04 15:36:12 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=264703</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=263392</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonathan Bedard">jbedard</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1987123</commentid>
    <comment_count>0</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2023-10-24 08:07:56 -0700</bug_when>
    <thetext>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&apos;t handle using two namespace packages which share a common parent package. Although we&apos;ve been able to work around this issue with `aliases` so far, we should have autoinstall correctly handle this situation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1988843</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-10-31 08:08:21 -0700</bug_when>
    <thetext>&lt;rdar://problem/117742039&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2079197</commentid>
    <comment_count>2</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2024-12-04 13:13:51 -0800</bug_when>
    <thetext>https://commits.webkit.org/230559@main added aliases in the form of:

AutoInstall.register(Package(&apos;logilab.common&apos;, Version(0, 58, 1), pypi_name=&apos;logilab-common&apos;, aliases=[&apos;logilab&apos;]))
AutoInstall.register(Package(&apos;logilab.astng&apos;, Version(0, 24, 1), pypi_name=&apos;logilab-astng&apos;, aliases=[&apos;logilab&apos;]))
AutoInstall.register(Package(&apos;zope.interface&apos;, Version(5, 1, 0), aliases=[&apos;zope&apos;], pypi_name=&apos;zope-interface&apos;))

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&apos;re installing into, which for logilab.common is autoinstalled_dir/logilab/common, but we don&apos;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&apos;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&apos;re using the legacy dist/setuptools install or installing from a wheel?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2079240</commentid>
    <comment_count>3</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2024-12-04 15:36:12 -0800</bug_when>
    <thetext>Bug 263392 is about deleting things, which is probably the majority of the problem here?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>