From f4e0d71e4459b976c6a81a85d64c04a3b87310c2 Mon Sep 17 00:00:00 2001 From: Ruben Di Battista Date: Tue, 21 Feb 2023 23:37:55 +0100 Subject: [PATCH 1/4] :package: build: Relabel manylinux wheel ignoring pyarrow --- ci/linux/repair-wheel.py | 52 ++++++++++++++++++++++++++++++++++++++++ ci/linux/repair-wheel.sh | 9 +++++++ pyproject.toml | 2 +- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 ci/linux/repair-wheel.py create mode 100644 ci/linux/repair-wheel.sh diff --git a/ci/linux/repair-wheel.py b/ci/linux/repair-wheel.py new file mode 100644 index 0000000..c285d5c --- /dev/null +++ b/ci/linux/repair-wheel.py @@ -0,0 +1,52 @@ +# /usr/bin/env python +"""Ignore libarrow libraries in the wheel""" + +import logging +import sys +from fnmatch import fnmatch + +from auditwheel.patcher import Patchelf +from auditwheel.policy import ( + POLICY_PRIORITY_HIGHEST, + POLICY_PRIORITY_LOWEST, + get_policy_by_name, + get_policy_name, +) +from auditwheel.repair import repair_wheel +from auditwheel.wheel_abi import analyze_wheel_abi + +logging.basicConfig(level=logging.INFO) + + +EXCLUDE_PATTERN = "libarrow*" + +if __name__ == "__main__": + wheel, dest_dir = sys.argv[1:] + + policy_name = get_policy_name(POLICY_PRIORITY_HIGHEST) + if policy_name is None: + raise ValueError("Invalid policy") + + policy = get_policy_by_name(policy_name) + if policy is None: + raise ValueError("Invalid policy") + + winfo = analyze_wheel_abi(wheel) + libs = winfo.external_refs[get_policy_name(POLICY_PRIORITY_LOWEST)]["libs"] + + excludes = [] + for lib in libs: + if fnmatch(lib, EXCLUDE_PATTERN): + excludes.append(lib) + + abis = [policy["name"]] + policy["aliases"] + + repair_wheel( + wheel, + abis, + out_dir=dest_dir, + lib_sdir=".libs", + update_tags=True, + patcher=Patchelf(), + exclude=excludes, + ) diff --git a/ci/linux/repair-wheel.sh b/ci/linux/repair-wheel.sh new file mode 100644 index 0000000..d6c22b2 --- /dev/null +++ b/ci/linux/repair-wheel.sh @@ -0,0 +1,9 @@ +#/usr/bin/env bash +set -e + +args=("$@") +wheel=${args[0]} +dest_dir=${args[1]} + +auditwheel show ${wheel} +auditwheel repair --exclude libarrow.so.1100 --exclude libarrow_python.so -w ${dest_dir} ${wheel} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index bf4012a..751d029 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,4 +45,4 @@ repair-wheel-command = "cp {wheel} {dest_dir}" [tool.cibuildwheel.linux] before-build = "bash ci/linux/prepare-build.sh" -repair-wheel-command = "cp {wheel} {dest_dir}" +repair-wheel-command = "bash ci/linux/repair-wheel.sh {wheel} {dest_dir}" From e8682963afc513cb1c34050ff5327e31a91cd8f2 Mon Sep 17 00:00:00 2001 From: Ruben Di Battista Date: Sun, 26 Feb 2023 13:12:19 +0100 Subject: [PATCH 2/4] :package: refactor: Version independent ignore --- ci/linux/repair-wheel.sh | 9 --------- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 ci/linux/repair-wheel.sh diff --git a/ci/linux/repair-wheel.sh b/ci/linux/repair-wheel.sh deleted file mode 100644 index d6c22b2..0000000 --- a/ci/linux/repair-wheel.sh +++ /dev/null @@ -1,9 +0,0 @@ -#/usr/bin/env bash -set -e - -args=("$@") -wheel=${args[0]} -dest_dir=${args[1]} - -auditwheel show ${wheel} -auditwheel repair --exclude libarrow.so.1100 --exclude libarrow_python.so -w ${dest_dir} ${wheel} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 751d029..f7d3916 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,4 +45,4 @@ repair-wheel-command = "cp {wheel} {dest_dir}" [tool.cibuildwheel.linux] before-build = "bash ci/linux/prepare-build.sh" -repair-wheel-command = "bash ci/linux/repair-wheel.sh {wheel} {dest_dir}" +repair-wheel-command = "/opt/_internal/pipx/venvs/auditwheel/bin/python ci/linux/repair-wheel.py {wheel} {dest_dir}" From 2deb04ed034676bea05f4e9177e9dc8402a5a9f1 Mon Sep 17 00:00:00 2001 From: Ruben Di Battista Date: Wed, 22 Feb 2023 00:29:23 +0100 Subject: [PATCH 3/4] :package: build: Remove invalid trove classifiers --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f7d3916..8819018 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,8 +15,6 @@ requires-python = ">=3.7" keywords = ["arrow", "postgresql"] license = { text = "MIT License" } classifiers = [ - "Framework :: Apache Arrow", - "Framework :: PostgreSQL", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Topic :: Database", From 2ab0a4090b7da8886a7a60fb0adfc51099156438 Mon Sep 17 00:00:00 2001 From: Ruben Di Battista Date: Sun, 26 Feb 2023 13:17:34 +0100 Subject: [PATCH 4/4] :package: fix: shebang --- ci/linux/repair-wheel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/linux/repair-wheel.py b/ci/linux/repair-wheel.py index c285d5c..dd826eb 100644 --- a/ci/linux/repair-wheel.py +++ b/ci/linux/repair-wheel.py @@ -1,4 +1,4 @@ -# /usr/bin/env python +#!/usr/bin/env python """Ignore libarrow libraries in the wheel""" import logging