From 5b85096238d5b831c6f5dc0f9dd068e02f720a4c Mon Sep 17 00:00:00 2001 From: Jeremy Volkman Date: Tue, 18 Apr 2023 14:37:00 -0700 Subject: [PATCH] deloceate: make copied lib files writeable --- pyproject.toml | 2 +- .../_vendor/delocate/delocating.py | 4 ++++ tools/vendoring/patches/delocate.chmod.patch | 22 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tools/vendoring/patches/delocate.chmod.patch diff --git a/pyproject.toml b/pyproject.toml index 823f7bd..09d7a38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "repairwheel" -version = "0.2.1" +version = "0.2.2" description = "Repair any wheel, anywhere" readme = "README.md" requires-python = ">= 3.7" diff --git a/src/repairwheel/_vendor/delocate/delocating.py b/src/repairwheel/_vendor/delocate/delocating.py index dbdcd80..a8ca72d 100644 --- a/src/repairwheel/_vendor/delocate/delocating.py +++ b/src/repairwheel/_vendor/delocate/delocating.py @@ -7,6 +7,7 @@ import logging import os import shutil +import stat import warnings from os.path import abspath, basename, dirname, exists from os.path import join as pjoin @@ -188,6 +189,9 @@ def _copy_required_libs( "Copying library %s to %s", old_path, relpath(new_path, root_path) ) shutil.copy(old_path, new_path) + statinfo = os.stat(new_path) + if not statinfo.st_mode & stat.S_IWRITE: + os.chmod(new_path, statinfo.st_mode | stat.S_IWRITE) # Delocate this file now that it is stored locally. needs_delocating.add(new_path) # Update out_lib_dict with the new file paths. diff --git a/tools/vendoring/patches/delocate.chmod.patch b/tools/vendoring/patches/delocate.chmod.patch new file mode 100644 index 0000000..4a1fce7 --- /dev/null +++ b/tools/vendoring/patches/delocate.chmod.patch @@ -0,0 +1,22 @@ +diff --git a/src/repairwheel/_vendor/delocate/delocating.py b/src/repairwheel/_vendor/delocate/delocating.py +index dbdcd80..a8ca72d 100644 +--- a/src/repairwheel/_vendor/delocate/delocating.py ++++ b/src/repairwheel/_vendor/delocate/delocating.py +@@ -7,6 +7,7 @@ import functools + import logging + import os + import shutil ++import stat + import warnings + from os.path import abspath, basename, dirname, exists + from os.path import join as pjoin +@@ -188,6 +189,9 @@ def _copy_required_libs( + "Copying library %s to %s", old_path, relpath(new_path, root_path) + ) + shutil.copy(old_path, new_path) ++ statinfo = os.stat(new_path) ++ if not statinfo.st_mode & stat.S_IWRITE: ++ os.chmod(new_path, statinfo.st_mode | stat.S_IWRITE) + # Delocate this file now that it is stored locally. + needs_delocating.add(new_path) + # Update out_lib_dict with the new file paths.