Skip to content

Commit d6de590

Browse files
committed
Patch wheel to work with the expected ABI tag scheme
1 parent 650d0c8 commit d6de590

File tree

7 files changed

+256
-5
lines changed

7 files changed

+256
-5
lines changed
Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
[[rules]]
2-
# This version doesn't need a patch, but we want to pin it. Our virtualenv seeder pins setuptools and pip to the bundled
2+
# 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-
# TODO we should make 0.40 work
4+
version = '== 0.40.*'
5+
patch = 'wheel-0.40.patch'
6+
subdir = 'src'
7+
8+
[[rules]]
59
version = '== 0.38.*'
10+
patch = 'wheel-0.38.patch'
11+
subdir = 'src'
12+
install-priority = 0
13+
14+
[[rules]]
15+
version = '>= 0.36, < 0.38'
16+
patch = 'wheel-0.37.patch'
17+
subdir = 'src'
18+
install-priority = 0
19+
20+
[[rules]]
21+
version = '== 0.35.*'
22+
patch = 'wheel-0.35.patch'
23+
subdir = 'src'
24+
install-priority = 0
625

726
[[rules]]
827
version = '< 0.35'
928
patch = 'wheel-pre-0.35.patch'
1029
subdir = 'src'
30+
install-priority = 0
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
2+
index 5dee1b7..4e24a02 100644
3+
--- a/wheel/bdist_wheel.py
4+
+++ b/wheel/bdist_wheel.py
5+
@@ -93,6 +93,9 @@ def get_abi_tag():
6+
abi = '%s%s%s%s%s' % (impl, tags.interpreter_version(), d, m, u)
7+
elif soabi and soabi.startswith('cpython-'):
8+
abi = 'cp' + soabi.split('-')[1]
9+
+ elif soabi and impl == "graalpy":
10+
+ abi = "-".join(soabi.split("-")[:3])
11+
+ abi = abi.replace(".", "_").replace("-", "_")
12+
elif soabi:
13+
abi = soabi.replace('.', '_').replace('-', '_')
14+
else:
15+
diff --git a/wheel/vendored/packaging/tags.py b/wheel/vendored/packaging/tags.py
16+
index ee529c8..f17868d 100644
17+
--- a/wheel/vendored/packaging/tags.py
18+
+++ b/wheel/vendored/packaging/tags.py
19+
@@ -270,10 +270,44 @@ def cpython_tags(
20+
21+
22+
def _generic_abi():
23+
- # type: () -> Iterator[str]
24+
- abi = sysconfig.get_config_var("SOABI")
25+
- if abi:
26+
- yield _normalize_string(abi)
27+
+ """
28+
+ Return the ABI tag based on EXT_SUFFIX.
29+
+ """
30+
+ # The following are examples of `EXT_SUFFIX`.
31+
+ # We want to keep the parts which are related to the ABI and remove the
32+
+ # parts which are related to the platform:
33+
+ # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310
34+
+ # - mac: '.cpython-310-darwin.so' => cp310
35+
+ # - win: '.cp310-win_amd64.pyd' => cp310
36+
+ # - win: '.pyd' => cp37 (uses _cpython_abis())
37+
+ # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73
38+
+ # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'
39+
+ # => graalpy_38_native
40+
+
41+
+ ext_suffix = _get_config_var("EXT_SUFFIX", warn=True)
42+
+ if not isinstance(ext_suffix, str) or ext_suffix[0] != ".":
43+
+ raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')")
44+
+ parts = ext_suffix.split(".")
45+
+ if len(parts) < 3:
46+
+ # CPython3.7 and earlier uses ".pyd" on Windows.
47+
+ return _cpython_abis(sys.version_info[:2])
48+
+ soabi = parts[1]
49+
+ if soabi.startswith("cpython"):
50+
+ # non-windows
51+
+ abi = "cp" + soabi.split("-")[1]
52+
+ elif soabi.startswith("cp"):
53+
+ # windows
54+
+ abi = soabi.split("-")[0]
55+
+ elif soabi.startswith("pypy"):
56+
+ abi = "-".join(soabi.split("-")[:2])
57+
+ elif soabi.startswith("graalpy"):
58+
+ abi = "-".join(soabi.split("-")[:3])
59+
+ elif soabi:
60+
+ # pyston, ironpython, others?
61+
+ abi = soabi
62+
+ else:
63+
+ return []
64+
+ return [_normalize_string(abi)]
65+
66+
67+
def generic_tags(
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
2+
index 80e43d0..87a8370 100644
3+
--- a/wheel/bdist_wheel.py
4+
+++ b/wheel/bdist_wheel.py
5+
@@ -101,6 +101,9 @@ def get_abi_tag():
6+
# we want something like pypy36-pp73
7+
abi = '-'.join(soabi.split('-')[:2])
8+
abi = abi.replace('.', '_').replace('-', '_')
9+
+ elif soabi and impl == "graalpy":
10+
+ abi = "-".join(soabi.split("-")[:3])
11+
+ abi = abi.replace(".", "_").replace("-", "_")
12+
elif soabi:
13+
abi = soabi.replace('.', '_').replace('-', '_')
14+
else:
15+
diff --git a/wheel/vendored/packaging/tags.py b/wheel/vendored/packaging/tags.py
16+
index c2a140c..ac7b5b6 100644
17+
--- a/wheel/vendored/packaging/tags.py
18+
+++ b/wheel/vendored/packaging/tags.py
19+
@@ -293,10 +293,44 @@ def cpython_tags(
20+
21+
22+
def _generic_abi():
23+
- # type: () -> Iterator[str]
24+
- abi = sysconfig.get_config_var("SOABI")
25+
- if abi:
26+
- yield _normalize_string(abi)
27+
+ """
28+
+ Return the ABI tag based on EXT_SUFFIX.
29+
+ """
30+
+ # The following are examples of `EXT_SUFFIX`.
31+
+ # We want to keep the parts which are related to the ABI and remove the
32+
+ # parts which are related to the platform:
33+
+ # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310
34+
+ # - mac: '.cpython-310-darwin.so' => cp310
35+
+ # - win: '.cp310-win_amd64.pyd' => cp310
36+
+ # - win: '.pyd' => cp37 (uses _cpython_abis())
37+
+ # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73
38+
+ # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'
39+
+ # => graalpy_38_native
40+
+
41+
+ ext_suffix = _get_config_var("EXT_SUFFIX", warn=True)
42+
+ if not isinstance(ext_suffix, str) or ext_suffix[0] != ".":
43+
+ raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')")
44+
+ parts = ext_suffix.split(".")
45+
+ if len(parts) < 3:
46+
+ # CPython3.7 and earlier uses ".pyd" on Windows.
47+
+ return _cpython_abis(sys.version_info[:2])
48+
+ soabi = parts[1]
49+
+ if soabi.startswith("cpython"):
50+
+ # non-windows
51+
+ abi = "cp" + soabi.split("-")[1]
52+
+ elif soabi.startswith("cp"):
53+
+ # windows
54+
+ abi = soabi.split("-")[0]
55+
+ elif soabi.startswith("pypy"):
56+
+ abi = "-".join(soabi.split("-")[:2])
57+
+ elif soabi.startswith("graalpy"):
58+
+ abi = "-".join(soabi.split("-")[:3])
59+
+ elif soabi:
60+
+ # pyston, ironpython, others?
61+
+ abi = soabi
62+
+ else:
63+
+ return []
64+
+ return [_normalize_string(abi)]
65+
66+
67+
def generic_tags(
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
2+
index 7fcf4a3..cfaab8c 100644
3+
--- a/wheel/bdist_wheel.py
4+
+++ b/wheel/bdist_wheel.py
5+
@@ -97,6 +97,9 @@ def get_abi_tag():
6+
# we want something like pypy36-pp73
7+
abi = "-".join(soabi.split("-")[:2])
8+
abi = abi.replace(".", "_").replace("-", "_")
9+
+ elif soabi and impl == "graalpy":
10+
+ abi = "-".join(soabi.split("-")[:3])
11+
+ abi = abi.replace(".", "_").replace("-", "_")
12+
elif soabi:
13+
abi = soabi.replace(".", "_").replace("-", "_")
14+
else:
15+
diff --git a/wheel/vendored/packaging/tags.py b/wheel/vendored/packaging/tags.py
16+
index 4e003a9..7fe165e 100644
17+
--- a/wheel/vendored/packaging/tags.py
18+
+++ b/wheel/vendored/packaging/tags.py
19+
@@ -215,10 +215,45 @@ def cpython_tags(
20+
yield Tag(interpreter, "abi3", platform_)
21+
22+
23+
-def _generic_abi() -> Iterator[str]:
24+
- abi = sysconfig.get_config_var("SOABI")
25+
- if abi:
26+
- yield _normalize_string(abi)
27+
+def _generic_abi() -> List[str]:
28+
+ """
29+
+ Return the ABI tag based on EXT_SUFFIX.
30+
+ """
31+
+ # The following are examples of `EXT_SUFFIX`.
32+
+ # We want to keep the parts which are related to the ABI and remove the
33+
+ # parts which are related to the platform:
34+
+ # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310
35+
+ # - mac: '.cpython-310-darwin.so' => cp310
36+
+ # - win: '.cp310-win_amd64.pyd' => cp310
37+
+ # - win: '.pyd' => cp37 (uses _cpython_abis())
38+
+ # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73
39+
+ # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'
40+
+ # => graalpy_38_native
41+
+
42+
+ ext_suffix = _get_config_var("EXT_SUFFIX", warn=True)
43+
+ if not isinstance(ext_suffix, str) or ext_suffix[0] != ".":
44+
+ raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')")
45+
+ parts = ext_suffix.split(".")
46+
+ if len(parts) < 3:
47+
+ # CPython3.7 and earlier uses ".pyd" on Windows.
48+
+ return _cpython_abis(sys.version_info[:2])
49+
+ soabi = parts[1]
50+
+ if soabi.startswith("cpython"):
51+
+ # non-windows
52+
+ abi = "cp" + soabi.split("-")[1]
53+
+ elif soabi.startswith("cp"):
54+
+ # windows
55+
+ abi = soabi.split("-")[0]
56+
+ elif soabi.startswith("pypy"):
57+
+ abi = "-".join(soabi.split("-")[:2])
58+
+ elif soabi.startswith("graalpy"):
59+
+ abi = "-".join(soabi.split("-")[:3])
60+
+ elif soabi:
61+
+ # pyston, ironpython, others?
62+
+ abi = soabi
63+
+ else:
64+
+ return []
65+
+ return [_normalize_string(abi)]
66+
67+
68+
def generic_tags(
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py
2+
index 28a9050..3184cb3 100644
3+
--- a/wheel/bdist_wheel.py
4+
+++ b/wheel/bdist_wheel.py
5+
@@ -114,6 +114,9 @@ def get_abi_tag():
6+
# we want something like pypy36-pp73
7+
abi = "-".join(soabi.split("-")[:2])
8+
abi = abi.replace(".", "_").replace("-", "_")
9+
+ elif soabi and impl == "graalpy":
10+
+ abi = "-".join(soabi.split("-")[:3])
11+
+ abi = abi.replace(".", "_").replace("-", "_")
12+
elif soabi:
13+
abi = soabi.replace(".", "_").replace("-", "_")
14+
else:
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
diff --git a/wheel/pep425tags.py b/wheel/pep425tags.py
2-
index 13b5073..3a20e23 100644
2+
index 0c25763..408b407 100644
33
--- a/wheel/pep425tags.py
44
+++ b/wheel/pep425tags.py
5-
@@ -31,6 +31,8 @@ def get_abbr_impl():
5+
@@ -38,6 +38,8 @@ def get_abbr_impl():
66
return 'ip'
77
elif impl == 'CPython':
88
return 'cp'
99
+ elif impl == 'GraalVM':
10-
+ return 'gp'
10+
+ return 'graalpy'
1111

1212
raise LookupError('Unknown Python implementation: ' + impl)
13+
14+
@@ -97,6 +99,9 @@ def get_abi_tag():
15+
abi = '%s%s%s%s%s' % (impl, get_impl_ver(), d, m, u)
16+
elif soabi and soabi.startswith('cpython-'):
17+
abi = 'cp' + soabi.split('-')[1]
18+
+ elif soabi and impl == "graalpy":
19+
+ abi = "-".join(soabi.split("-")[:3])
20+
+ abi = abi.replace(".", "_").replace("-", "_")
21+
elif soabi:
22+
abi = soabi.replace('.', '_').replace('-', '_')
23+
else:

mx.graalpython/mx_graalpython.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,6 +1996,10 @@ def _python_checkpatchfiles():
19961996
# Empty license field. It's MIT
19971997
'urllib3-2.patch',
19981998
# Empty license field. It's MIT
1999+
'wheel-0.40.patch',
2000+
'wheel-0.38.patch',
2001+
'wheel-0.37.patch',
2002+
'wheel-0.35.patch',
19992003
'wheel-pre-0.35.patch',
20002004
}
20012005
allowed_licenses = [

0 commit comments

Comments
 (0)