Skip to content

Update blob.py #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
9 changes: 5 additions & 4 deletions src/ZODB/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,13 +942,14 @@ def remove_committed_dir(path):
filename = os.path.join(dirpath, filename)
remove_committed(filename)
shutil.rmtree(path)

link_or_copy = shutil.copy
link_or_copy = shutil.copy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment must be at the same indentation level as the function definitions: it is not part of the function.

Suggested change
link_or_copy = shutil.copy
link_or_copy = shutil.copy

else:
remove_committed = os.remove
remove_committed_dir = shutil.rmtree
link_or_copy = os.link

try:
link_or_copy = os.link
except AttributeError: #pragma: no cover
link_or_copy = shutil.copy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment indicating why we fall back to shutil.copy here, e.g.:

Suggested change
except AttributeError: #pragma: no cover
link_or_copy = shutil.copy
except AttributeError: #pragma: no cover
# FBO termux on Android.
# See https://github.com/zopefoundation/ZODB/issues/257
link_or_copy = shutil.copy

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Just added those comments. I tried to see how the proposed change to blob.py within ZODB works with other python implementations like for iSH for IOS which has Alpine linux as it's underpinnings. Unfortunately, their python is so broken with many dependencies not available that libraries such as ZODB won't even install.


def find_global_Blob(module, class_):
if module == 'ZODB.blob' and class_ == 'Blob':
Expand Down