Skip to content

Commit 860d127

Browse files
committed
[GR-48182] Accomodate changes in wheel architecture detection
2 parents cad23f2 + a4262f9 commit 860d127

File tree

14 files changed

+319
-20
lines changed

14 files changed

+319
-20
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/mesonpy/_tags.py b/mesonpy/_tags.py
2+
index 7416008..d7ca216 100644
3+
--- a/mesonpy/_tags.py
4+
+++ b/mesonpy/_tags.py
5+
@@ -2,6 +2,7 @@
6+
7+
import os
8+
import platform
9+
+import struct
10+
import sys
11+
import sysconfig
12+
13+
@@ -18,7 +19,7 @@ INTERPRETERS = {
14+
}
15+
16+
17+
-_32_BIT_INTERPRETER = sys.maxsize <= 2**32
18+
+_32_BIT_INTERPRETER = struct.calcsize("P") == 4
19+
20+
21+
def get_interpreter_tag() -> str:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[rules]]
2+
# Backport pypa/packaging PR for fixing graalpy architecture
3+
patch = 'meson-python.patch'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[rules]]
2+
# msimacek: backport of unmerged https://github.com/pypa/packaging/pull/711
3+
patch = 'packaging.patch'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/packaging/tags.py b/packaging/tags.py
2+
index 76d2434..fe793d9 100644
3+
--- a/packaging/tags.py
4+
+++ b/packaging/tags.py
5+
@@ -4,6 +4,7 @@
6+
7+
import logging
8+
import platform
9+
+import struct
10+
import subprocess
11+
import sys
12+
import sysconfig
13+
@@ -37,7 +38,7 @@ INTERPRETER_SHORT_NAMES: Dict[str, str] = {
14+
}
15+
16+
17+
-_32_BIT_INTERPRETER = sys.maxsize <= 2**32
18+
+_32_BIT_INTERPRETER = struct.calcsize("P") == 4
19+
20+
21+
class Tag:

graalpython/lib-graalpython/patches/pip/pip-22.2.2.patch

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,27 @@ index 78b5c13..18a184c 100644
301301
+ from pip._internal.utils.graalpy import apply_graalpy_patches
302302
+ apply_graalpy_patches(filename, location)
303303
diff --git a/pip/_vendor/packaging/tags.py b/pip/_vendor/packaging/tags.py
304-
index 9a3d25a..a1e93f2 100644
304+
index 9a3d25a..e0e7b31 100644
305305
--- a/pip/_vendor/packaging/tags.py
306306
+++ b/pip/_vendor/packaging/tags.py
307-
@@ -224,10 +224,46 @@ def cpython_tags(
307+
@@ -4,6 +4,7 @@
308+
309+
import logging
310+
import platform
311+
+import struct
312+
import sys
313+
import sysconfig
314+
from importlib.machinery import EXTENSION_SUFFIXES
315+
@@ -36,7 +37,7 @@ INTERPRETER_SHORT_NAMES: Dict[str, str] = {
316+
}
317+
318+
319+
-_32_BIT_INTERPRETER = sys.maxsize <= 2 ** 32
320+
+_32_BIT_INTERPRETER = struct.calcsize("P") == 4
321+
322+
323+
class Tag:
324+
@@ -224,10 +225,46 @@ def cpython_tags(
308325
yield Tag(interpreter, "abi3", platform_)
309326

310327

graalpython/lib-graalpython/patches/wheel/metadata.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
[[rules]]
22
# Always pin a specific version. Our virtualenv seeder pins setuptools and pip to the bundled
33
# ones, so it makes sense to always pin wheel too to avoid it getting out of sync with setuptools.
4-
version = '== 0.40.*'
4+
version = '== 0.41.2'
5+
# Backport pypa/packaging PR for fixing graalpy architecture. Not strictly necessary for building wheels
6+
patch = 'wheel-0.41.2.patch'
7+
subdir = 'src'
8+
9+
[[rules]]
10+
version = '>= 0.41.2'
11+
patch = 'wheel-0.41.2.patch'
12+
subdir = 'src'
13+
install-priority = 0
14+
15+
[[rules]]
16+
version = '>= 0.40, < 0.41.2'
517
patch = 'wheel-0.40.patch'
618
subdir = 'src'
19+
install-priority = 0
720

821
[[rules]]
922
version = '== 0.38.*'

graalpython/lib-graalpython/patches/wheel/wheel-0.35.patch

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
2-
index 5dee1b7..4e24a02 100644
2+
index 5dee1b7..de7af43 100644
33
--- a/wheel/bdist_wheel.py
44
+++ b/wheel/bdist_wheel.py
5-
@@ -93,6 +93,9 @@ def get_abi_tag():
5+
@@ -11,6 +11,7 @@ import stat
6+
import sys
7+
import re
8+
import warnings
9+
+import struct
10+
from collections import OrderedDict
11+
from email.generator import Generator
12+
from distutils.core import Command
13+
@@ -46,7 +47,7 @@ def get_platform(archive_root):
14+
result = distutils.util.get_platform()
15+
if result.startswith("macosx") and archive_root is not None:
16+
result = calculate_macosx_platform_tag(archive_root, result)
17+
- if result == "linux_x86_64" and sys.maxsize == 2147483647:
18+
+ if result == "linux_x86_64" and struct.calcsize("P") == 4:
19+
# pip pull request #3497
20+
result = "linux_i686"
21+
return result
22+
@@ -93,6 +94,9 @@ def get_abi_tag():
623
abi = '%s%s%s%s%s' % (impl, tags.interpreter_version(), d, m, u)
724
elif soabi and soabi.startswith('cpython-'):
825
abi = 'cp' + soabi.split('-')[1]
@@ -12,10 +29,28 @@ index 5dee1b7..4e24a02 100644
1229
elif soabi:
1330
abi = soabi.replace('.', '_').replace('-', '_')
1431
else:
32+
@@ -251,7 +255,7 @@ class bdist_wheel(Command):
33+
# modules, use the default platform name.
34+
plat_name = get_platform(self.bdist_dir)
35+
36+
- if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize == 2147483647:
37+
+ if plat_name in ('linux-x86_64', 'linux_x86_64') and struct.calcsize("P") == 4:
38+
plat_name = 'linux_i686'
39+
40+
plat_name = plat_name.lower().replace('-', '_').replace('.', '_')
1541
diff --git a/wheel/vendored/packaging/tags.py b/wheel/vendored/packaging/tags.py
16-
index ee529c8..f17868d 100644
42+
index ee529c8..b8c1b6f 100644
1743
--- a/wheel/vendored/packaging/tags.py
1844
+++ b/wheel/vendored/packaging/tags.py
45+
@@ -56,7 +56,7 @@ INTERPRETER_SHORT_NAMES = {
46+
} # type: Dict[str, str]
47+
48+
49+
-_32_BIT_INTERPRETER = sys.maxsize <= 2 ** 32
50+
+_32_BIT_INTERPRETER = struct.calcsize("P") == 4
51+
52+
53+
class Tag(object):
1954
@@ -270,10 +270,44 @@ def cpython_tags(
2055

2156

graalpython/lib-graalpython/patches/wheel/wheel-0.37.patch

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
2-
index 80e43d0..87a8370 100644
2+
index 80e43d0..ccaad85 100644
33
--- a/wheel/bdist_wheel.py
44
+++ b/wheel/bdist_wheel.py
5-
@@ -101,6 +101,9 @@ def get_abi_tag():
5+
@@ -11,6 +11,7 @@ import stat
6+
import sys
7+
import re
8+
import warnings
9+
+import struct
10+
from collections import OrderedDict
11+
from distutils.core import Command
12+
from distutils import log as logger
13+
@@ -50,7 +51,7 @@ def get_platform(archive_root):
14+
result = distutils.util.get_platform()
15+
if result.startswith("macosx") and archive_root is not None:
16+
result = calculate_macosx_platform_tag(archive_root, result)
17+
- if result == "linux_x86_64" and sys.maxsize == 2147483647:
18+
+ if result == "linux_x86_64" and struct.calcsize("P") == 4:
19+
# pip pull request #3497
20+
result = "linux_i686"
21+
return result
22+
@@ -101,6 +102,9 @@ def get_abi_tag():
623
# we want something like pypy36-pp73
724
abi = '-'.join(soabi.split('-')[:2])
825
abi = abi.replace('.', '_').replace('-', '_')
@@ -12,10 +29,28 @@ index 80e43d0..87a8370 100644
1229
elif soabi:
1330
abi = soabi.replace('.', '_').replace('-', '_')
1431
else:
32+
@@ -259,7 +263,7 @@ class bdist_wheel(Command):
33+
# modules, use the default platform name.
34+
plat_name = get_platform(self.bdist_dir)
35+
36+
- if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize == 2147483647:
37+
+ if plat_name in ('linux-x86_64', 'linux_x86_64') and struct.calcsize("P") == 4:
38+
plat_name = 'linux_i686'
39+
40+
plat_name = plat_name.lower().replace('-', '_').replace('.', '_')
1541
diff --git a/wheel/vendored/packaging/tags.py b/wheel/vendored/packaging/tags.py
16-
index c2a140c..ac7b5b6 100644
42+
index c2a140c..c6fe42f 100644
1743
--- a/wheel/vendored/packaging/tags.py
1844
+++ b/wheel/vendored/packaging/tags.py
45+
@@ -55,7 +55,7 @@ INTERPRETER_SHORT_NAMES = {
46+
} # type: Dict[str, str]
47+
48+
49+
-_32_BIT_INTERPRETER = sys.maxsize <= 2 ** 32
50+
+_32_BIT_INTERPRETER = struct.calcsize("P") == 4
51+
52+
53+
_LEGACY_MANYLINUX_MAP = {
1954
@@ -293,10 +293,44 @@ def cpython_tags(
2055

2156

graalpython/lib-graalpython/patches/wheel/wheel-0.38.patch

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
2-
index 7fcf4a3..cfaab8c 100644
2+
index 7fcf4a3..4359ecc 100644
33
--- a/wheel/bdist_wheel.py
44
+++ b/wheel/bdist_wheel.py
5-
@@ -97,6 +97,9 @@ def get_abi_tag():
5+
@@ -13,6 +13,7 @@ import stat
6+
import sys
7+
import sysconfig
8+
import warnings
9+
+import struct
10+
from collections import OrderedDict
11+
from email.generator import BytesGenerator, Generator
12+
from email.policy import EmailPolicy
13+
@@ -49,7 +50,7 @@ def get_platform(archive_root):
14+
result = sysconfig.get_platform()
15+
if result.startswith("macosx") and archive_root is not None:
16+
result = calculate_macosx_platform_tag(archive_root, result)
17+
- elif result == "linux-x86_64" and sys.maxsize == 2147483647:
18+
+ elif result == "linux-x86_64" and struct.calcsize("P") == 4:
19+
# pip pull request #3497
20+
result = "linux-i686"
21+
22+
@@ -97,6 +98,9 @@ def get_abi_tag():
623
# we want something like pypy36-pp73
724
abi = "-".join(soabi.split("-")[:2])
825
abi = abi.replace(".", "_").replace("-", "_")
@@ -12,11 +29,37 @@ index 7fcf4a3..cfaab8c 100644
1229
elif soabi:
1330
abi = soabi.replace(".", "_").replace("-", "_")
1431
else:
32+
@@ -281,7 +285,7 @@ class bdist_wheel(Command):
33+
34+
if (
35+
plat_name in ("linux-x86_64", "linux_x86_64")
36+
- and sys.maxsize == 2147483647
37+
+ and struct.calcsize("P") == 4
38+
):
39+
plat_name = "linux_i686"
40+
1541
diff --git a/wheel/vendored/packaging/tags.py b/wheel/vendored/packaging/tags.py
16-
index 4e003a9..7fe165e 100644
42+
index 4e003a9..7c2058f 100644
1743
--- a/wheel/vendored/packaging/tags.py
1844
+++ b/wheel/vendored/packaging/tags.py
19-
@@ -215,10 +215,45 @@ def cpython_tags(
45+
@@ -6,6 +6,7 @@ from __future__ import annotations
46+
47+
import logging
48+
import platform
49+
+import struct
50+
import sys
51+
import sysconfig
52+
from importlib.machinery import EXTENSION_SUFFIXES
53+
@@ -27,7 +28,7 @@ INTERPRETER_SHORT_NAMES: dict[str, str] = {
54+
}
55+
56+
57+
-_32_BIT_INTERPRETER = sys.maxsize <= 2 ** 32
58+
+_32_BIT_INTERPRETER = struct.calcsize("P") == 4
59+
60+
61+
class Tag:
62+
@@ -215,10 +216,45 @@ def cpython_tags(
2063
yield Tag(interpreter, "abi3", platform_)
2164

2265

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
2-
index 28a9050..3184cb3 100644
2+
index 28a9050..21df4d9 100644
33
--- a/wheel/bdist_wheel.py
44
+++ b/wheel/bdist_wheel.py
5-
@@ -114,6 +114,9 @@ def get_abi_tag():
5+
@@ -13,6 +13,7 @@ import stat
6+
import sys
7+
import sysconfig
8+
import warnings
9+
+import struct
10+
from collections import OrderedDict
11+
from email.generator import BytesGenerator, Generator
12+
from email.policy import EmailPolicy
13+
@@ -66,7 +67,7 @@ def get_platform(archive_root):
14+
result = sysconfig.get_platform()
15+
if result.startswith("macosx") and archive_root is not None:
16+
result = calculate_macosx_platform_tag(archive_root, result)
17+
- elif result == "linux-x86_64" and sys.maxsize == 2147483647:
18+
+ elif result == "linux-x86_64" and struct.calcsize("P") == 4:
19+
# pip pull request #3497
20+
result = "linux-i686"
21+
22+
@@ -114,6 +115,9 @@ def get_abi_tag():
623
# we want something like pypy36-pp73
724
abi = "-".join(soabi.split("-")[:2])
825
abi = abi.replace(".", "_").replace("-", "_")
@@ -12,3 +29,33 @@ index 28a9050..3184cb3 100644
1229
elif soabi:
1330
abi = soabi.replace(".", "_").replace("-", "_")
1431
else:
32+
@@ -297,7 +301,7 @@ class bdist_wheel(Command):
33+
34+
if (
35+
plat_name in ("linux-x86_64", "linux_x86_64")
36+
- and sys.maxsize == 2147483647
37+
+ and struct.calcsize("P") == 4
38+
):
39+
plat_name = "linux_i686"
40+
41+
diff --git a/wheel/vendored/packaging/tags.py b/wheel/vendored/packaging/tags.py
42+
index 19ccbde..dd01a7d 100644
43+
--- a/wheel/vendored/packaging/tags.py
44+
+++ b/wheel/vendored/packaging/tags.py
45+
@@ -4,6 +4,7 @@
46+
47+
import logging
48+
import platform
49+
+import struct
50+
import subprocess
51+
import sys
52+
import sysconfig
53+
@@ -37,7 +38,7 @@ INTERPRETER_SHORT_NAMES: Dict[str, str] = {
54+
}
55+
56+
57+
-_32_BIT_INTERPRETER = sys.maxsize <= 2**32
58+
+_32_BIT_INTERPRETER = struct.calcsize("P") == 4
59+
60+
61+
class Tag:

0 commit comments

Comments
 (0)