<?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>264703</bug_id>
          
          <creation_ts>2023-11-12 06:01:13 -0800</creation_ts>
          <short_desc>[AutoInstall] unable to install zope.interface on Python &lt; 3.9</short_desc>
          <delta_ts>2023-11-16 10:16:01 -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>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>264755</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=263485</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=263589</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="Sam Sneddon [:gsnedders]">gsnedders</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>jbedard</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1991958</commentid>
    <comment_count>0</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2023-11-12 06:01:13 -0800</bug_when>
    <thetext>After deleting Tools/Scripts/libraries/autoinstalled/python-2-x86_64:

Downloading setuptools-44.1.1...
Installed setuptools-44.1.1!
Downloading wheel-0.35.1...
Installed wheel-0.35.1!
Downloading pyparsing-2.4.7...
Installed pyparsing-2.4.7!
Downloading packaging-20.4.0...
Installed packaging-20.4.0!
Downloading setuptools-scm-5.0.2...
Installed setuptools-scm-5.0.2!
Downloading urllib3-1.26.17...
Installed urllib3-1.26.17!
Downloading requests-2.26.0...
Installed requests-2.26.0!
Downloading chardet-3.0.4...
Installed chardet-3.0.4!
Downloading certifi-2021.10.8...
Installed certifi-2021.10.8!
Downloading idna-2.10.0...
Installed idna-2.10.0!
Downloading PySocks-1.7.1...
Installed PySocks-1.7.1!
Downloading mechanize-0.4.5...
Installed mechanize-0.4.5!
Downloading pyfakefs-3.7.2...
Installed pyfakefs-3.7.2!
Downloading pycodestyle-2.5.0...
Installed pycodestyle-2.5.0!
Downloading mock-3.0.5...
Installed mock-3.0.5!
Downloading atomicwrites-1.1.5...
Installed atomicwrites-1.1.5!
Downloading py-1.11.0...
Installed py-1.11.0!
Downloading funcsigs-1.0.2...
Installed funcsigs-1.0.2!
Downloading beautifulsoup4-4.9.3...
Installed beautifulsoup4-4.9.3!
Downloading zope-interface-5.1.0...
Failed to install zope-interface-5.1.0!
...
INTERNALERROR&gt;   File &quot;/Volumes/gsnedders/projects/Safari/OpenSource/Tools/Scripts/webkitpy/conftest.py&quot;, line 112, in pytest_collection_finish
INTERNALERROR&gt;     AutoInstall.install_everything()
INTERNALERROR&gt;   File &quot;/Volumes/gsnedders/projects/Safari/OpenSource/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py&quot;, line 687, in install_everything
INTERNALERROR&gt;     package.install()
INTERNALERROR&gt;   File &quot;/Volumes/gsnedders/projects/Safari/OpenSource/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py&quot;, line 416, in install
INTERNALERROR&gt;     raise OSError(&apos;Cannot install {}, could not find setup.py&apos;.format(self.name))
INTERNALERROR&gt; OSError: Cannot install zope.interface, could not find setup.py

Will do some brief investigation on Monday.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1991959</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-11-12 06:01:24 -0800</bug_when>
    <thetext>&lt;rdar://problem/118297071&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1992081</commentid>
    <comment_count>2</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2023-11-13 05:02:09 -0800</bug_when>
    <thetext>This seems practically identical to bug 263485?

There https://github.com/WebKit/WebKit/pull/19384 eventually got closed in preference for using aliases.

That said, I _still_ don&apos;t understand how aliases actually solve this. Their only behaviour is:

        for alias in package.aliases:
            cls.packages[alias].append(package)
        cls.packages[package.name].append(package)

i.e., packages get registered under both their own name and their aliases.

So zope.interface gets registered for both &quot;zope&quot; and &quot;zope.interface&quot;.

I think this might practically only be a problem when the AutoInstaller is manually invoked (either with AutoInstall.install(&quot;zope.interface&quot;) or AutoInstall.install_everything()).

I suspect this is potentially just a problem based on install order? And maybe we just haven&apos;t hit this on Python 3 due to hash randomization? Or it could be some import machinary change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1992083</commentid>
    <comment_count>3</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2023-11-13 05:13:57 -0800</bug_when>
    <thetext>Ah, this does also fail on Python 3, just only when there are wheels, and that&apos;s only Python 3.8 and earlier (c.f. https://pypi.org/project/zope.interface/5.1.0/#files).

The following fails on Python 3.8 and earlier, and it doesn&apos;t matter when it&apos;s explicitly installed or imported:

```
import tempfile
import shutil

from webkitcorepy.autoinstall import AutoInstall, Package, Version

tmpdirname = tempfile.mkdtemp()

try:
    AutoInstall.set_directory(tmpdirname)

    zope_interface = Package(
        &quot;zope.interface&quot;, Version(5, 1, 0), aliases=[&quot;zope&quot;], pypi_name=&quot;zope-interface&quot;
    )
    AutoInstall.register(zope_interface)
    AutoInstall.install(zope_interface)
finally:
    shutil.rmtree(tmpdirname)
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1993163</commentid>
    <comment_count>4</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2023-11-16 10:16:01 -0800</bug_when>
    <thetext>Effectively fixed by bug 264755.

*** This bug has been marked as a duplicate of bug 264755 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>