Skip to content

Commit cf564cc

Browse files
[Storage] Enable Py_LIMITED_API for extensions (#34523)
1 parent 3d314d8 commit cf564cc

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

sdk/storage/azure-storage-extensions/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ bandit = false
1414
suppressed_skip_warnings = ["*"]
1515

1616
[tool.cibuildwheel]
17-
build = ["cp38*", "cp39*", "cp310*", "cp311*", "cp312*", "pp38*", "pp39*", "pp310*"]
17+
build = ["cp38*", "pp38*", "pp39*", "pp310*"]
1818
test-requires = "pytest"
1919
test-command = "pytest {project}/tests"
2020
test-skip = "*-macosx_arm64"
@@ -24,6 +24,7 @@ archs = "x86_64 aarch64"
2424

2525
[tool.cibuildwheel.macos]
2626
archs = "x86_64 arm64"
27+
environment = "CFLAGS='-Wno-implicit-function-declaration'"
2728

2829
[tool.cibuildwheel.windows]
2930
archs = "AMD64"

sdk/storage/azure-storage-extensions/setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66

77
import os
88
from setuptools import setup, Extension
9+
from wheel.bdist_wheel import bdist_wheel
10+
11+
12+
class bdist_wheel_abi3(bdist_wheel):
13+
"""Override bdist_wheel tag behavior to add abi3 tag."""
14+
def get_tag(self):
15+
python, abi, plat = super().get_tag()
16+
17+
if python.startswith("cp"):
18+
return python, "abi3", plat
19+
return python, abi, plat
20+
921

1022
PACKAGE_NAME = "azure-storage-extensions"
1123
PACKAGE_PPRINT_NAME = "Azure Storage Extensions"
@@ -43,7 +55,9 @@
4355
Extension(
4456
'crc64',
4557
[os.path.join(package_folder_path, "crc64", "crc64module.c")],
58+
define_macros=[("Py_LIMITED_API", "3")],
4659
py_limited_api=True
4760
),
4861
],
62+
cmdclass={"bdist_wheel": bdist_wheel_abi3},
4963
)

tools/azure-sdk-tools/ci_tools/build.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,11 @@ def create_package(
179179
dist = get_artifact_directory(dest_folder)
180180
setup_parsed = ParsedSetup.from_path(setup_directory_or_file)
181181

182-
if setup_parsed.ext_modules:
183-
run([sys.executable, "-m", "cibuildwheel", "--output-dir", dist], cwd=setup_parsed.folder, check=True)
184-
185182
if enable_wheel:
186-
run([sys.executable, "setup.py", "bdist_wheel", "-d", dist], cwd=setup_parsed.folder, check=True)
183+
if setup_parsed.ext_modules:
184+
run([sys.executable, "-m", "cibuildwheel", "--output-dir", dist], cwd=setup_parsed.folder, check=True)
185+
else:
186+
run([sys.executable, "setup.py", "bdist_wheel", "-d", dist], cwd=setup_parsed.folder, check=True)
187+
187188
if enable_sdist:
188189
run([sys.executable, "setup.py", "sdist", "-d", dist], cwd=setup_parsed.folder, check=True)

0 commit comments

Comments
 (0)