这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda/core/path_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def verify(self):
update_prefix(self.intermediate_path,
context.target_prefix_override or self.target_prefix,
self.prefix_placeholder,
self.file_mode)
self.file_mode, subdir=self.package_info.repodata_record.subdir)
except _PaddingError:
raise PaddingError(self.target_full_path, self.prefix_placeholder,
len(self.prefix_placeholder))
Expand Down
12 changes: 10 additions & 2 deletions conda/core/portability.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
from os.path import realpath
import re
import struct
import subprocess
import sys

from ..base.constants import PREFIX_PLACEHOLDER
from ..base.context import context
from ..common.compat import on_win
from ..exceptions import CondaIOError, BinaryPrefixReplacementError
from ..gateways.disk.update import CancelOperation, update_file_in_place_as_binary
Expand All @@ -29,7 +32,8 @@ class _PaddingError(Exception):
pass


def update_prefix(path, new_prefix, placeholder=PREFIX_PLACEHOLDER, mode=FileMode.text):
def update_prefix(path, new_prefix, placeholder=PREFIX_PLACEHOLDER, mode=FileMode.text,
subdir=context.subdir):
if on_win and mode == FileMode.text:
# force all prefix replacements to forward slashes to simplify need to escape backslashes
# replace with unix-style path separators
Expand All @@ -56,7 +60,11 @@ def _update_prefix(original_data):

return data

update_file_in_place_as_binary(realpath(path), _update_prefix)
updated = update_file_in_place_as_binary(realpath(path), _update_prefix)

if updated and mode == FileMode.binary and subdir == "osx-arm64" and sys.platform == "darwin":
# Apple arm64 needs signed executables
subprocess.run(['/usr/bin/codesign', '-s', '-', '-f', realpath(path)])


def replace_prefix(mode, data, placeholder, new_prefix):
Expand Down
2 changes: 2 additions & 0 deletions conda/gateways/disk/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ def update_file_in_place_as_binary(file_full_path, callback):
try:
fh.write(callback(data))
fh.truncate()
return True
except CancelOperation:
pass # NOQA
finally:
if fh:
fh.close()
return False


def rename(source_path, destination_path, force=False):
Expand Down