Skip to content

Commit

Permalink
deloceate: make copied lib files writeable
Browse files Browse the repository at this point in the history
  • Loading branch information
jvolkman committed Apr 18, 2023
1 parent e2f0815 commit 5b85096
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/repairwheel/_vendor/delocate/delocating.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
22 changes: 22 additions & 0 deletions tools/vendoring/patches/delocate.chmod.patch
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 5b85096

Please sign in to comment.