<?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>224669</bug_id>
          
          <creation_ts>2021-04-16 06:08:56 -0700</creation_ts>
          <short_desc>AutoInstaller should name directory based on ABI</short_desc>
          <delta_ts>2023-10-03 18:35:12 -0700</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>REOPENED</bug_status>
          <resolution></resolution>
          
          
          <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="Jonathan Bedard">jbedard</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1751041</commentid>
    <comment_count>0</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2021-04-16 06:08:56 -0700</bug_when>
    <thetext>Currently we install Python libraries in python-2 and python-3, based on:

Tools/Scripts/webkitpy/__init__.py
34:AutoInstall.set_directory(os.path.join(libraries, &apos;autoinstalled&apos;, &apos;python-{}&apos;.format(sys.version_info[0])))

However, this is really an oversimplification of Python ABIs. Notably, while there&apos;s generally ABI compatibility between bug fix releases, there aren&apos;t between minor releases (e.g., Python 3.8 and Python 3.9).

Basing something on PEP 3147 (https://www.python.org/dev/peps/pep-3147/) probably makes a fair bit of sense. Essentially, on Python 3, we should at least use sys.implementation.cache_tag instead.

Given we do care about ABI here, we probably should even care about ABI detail; CPython uses SOABI (accessible via sysconfig.get_config_var(&quot;SOABI&quot;)) for this, but this only exists on POSIX-like systems. In reality, we probably don&apos;t need to store the platform in the string, so we can probably just use sys.implementation.cache_tag + sys.abiflags?

Opinions?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1751042</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2021-04-16 06:09:58 -0700</bug_when>
    <thetext>Oh, I meant to link PEP 3149 (https://www.python.org/dev/peps/pep-3149/) which covers ABI version tagged .so files.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1753691</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-04-23 13:09:02 -0700</bug_when>
    <thetext>&lt;rdar://problem/77083105&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1972500</commentid>
    <comment_count>3</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2023-08-21 15:30:00 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/16903</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1974183</commentid>
    <comment_count>4</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2023-08-29 06:11:33 -0700</bug_when>
    <thetext>Because I was getting confused in what situation this wasn&apos;t working properly, to quote my comment from the PR:

&gt; Pushing this because having it locally helps nobody. Keeping this as a draft because I&apos;m now somewhat confused by the necessity of this—[PEP 3149](https://peps.python.org/pep-3149/) should make it safe, provided we shard the top-level directory well enough (which we do except in the face of OS upgrades). And yet I&apos;ve frequently had things fail on Arch Linux when running webkitpy against differing CPython 3 versions, which… shouldn&apos;t happen. Should check what&apos;s going on there, and decide what to do based on that.

Running:

```
git clean -Xfd Tools/Scripts
python3.9 Tools/Scripts/test-webkitpy --all
python3.10 Tools/Scripts/test-webkitpy --all
```

fails with:

```
    File &quot;/Volumes/gsnedders/projects/Safari/OpenSource/Tools/Scripts/libraries/autoinstalled/python-3-arm64/lupa/__init__.py&quot;, line 32, in &lt;module&gt;
      from lupa._lupa import *
  ModuleNotFoundError: No module named &apos;lupa._lupa&apos;
```

And this happens because:

```
% find Tools/Scripts/libraries/autoinstalled/python-3-arm64 -name &apos;_lupa.*&apos;
Tools/Scripts/libraries/autoinstalled/python-3-arm64/lupa/_lupa.cpython-39-darwin.so
```

And because CPython 3.10 doesn&apos;t implement the CPython 3.9 ABI, this fails.

There&apos;s a variety of extension modules that get auto-installed, but most of these are optional &quot;speedup&quot; modules (or using the &quot;Stable ABI&quot;), hence most of the time this succeeds outside of our tests:

```
% find Tools/Scripts/libraries/autoinstalled/python-3-arm64 -name &apos;*.so&apos;   
Tools/Scripts/libraries/autoinstalled/python-3-arm64/selenium/webdriver/firefox/amd64/x_ignore_nofocus.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/selenium/webdriver/firefox/x86/x_ignore_nofocus.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/markupsafe/_speedups.cpython-39-darwin.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/cryptography/hazmat/bindings/_openssl.abi3.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/cryptography/hazmat/bindings/_rust.abi3.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/hiredis/hiredis.cpython-39-darwin.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/websockets/speedups.cpython-39-darwin.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/lupa/_lupa.cpython-39-darwin.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/_cffi_backend.cpython-39-darwin.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/coverage/tracer.cpython-39-darwin.so
Tools/Scripts/libraries/autoinstalled/python-3-arm64/zope/interface/_zope_interface_coptimizations.cpython-39-darwin.so
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1978697</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-09-20 09:55:30 -0700</bug_when>
    <thetext>Committed 268205@main (17ed49517923): &lt;https://commits.webkit.org/268205@main&gt;

Reviewed commits have been landed. Closing PR #16903 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1978881</commentid>
    <comment_count>6</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2023-09-20 20:23:23 -0700</bug_when>
    <thetext>Reverted by https://github.com/WebKit/WebKit/pull/18004</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1978882</commentid>
    <comment_count>7</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2023-09-20 20:23:25 -0700</bug_when>
    <thetext>Re-opening for pull request https://github.com/WebKit/WebKit/pull/18004</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1978885</commentid>
    <comment_count>8</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-09-20 20:38:25 -0700</bug_when>
    <thetext>Committed 268230@main (01641ad43827): &lt;https://commits.webkit.org/268230@main&gt;

Reviewed commits have been landed. Closing PR #18004 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1982323</commentid>
    <comment_count>9</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2023-10-03 18:35:12 -0700</bug_when>
    <thetext>Reopening because of revert.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>