Skip to content
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

Fix installer creation crash #1571

Merged
merged 2 commits into from
Jan 29, 2021
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
12 changes: 9 additions & 3 deletions installer/dials_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import sys
import traceback

# This file needs to remain Python 2.7 compatible
# due to the underlying cctbx installer logic


installer_path = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
libtbx_path = os.path.join(installer_path, "lib")
if libtbx_path not in sys.path:
Expand Down Expand Up @@ -108,7 +112,8 @@ def rmdir(subdir):
total_size += os.path.getsize(fp)
num_files += 1
print(
f"Removing {humansize(total_size):9}, {num_files:4d} files from {subdir}"
"Removing %9s, %4d files from %s"
% (humansize(total_size), num_files, subdir)
)
shutil.rmtree(fullpath)
self._cleaned_size = self._cleaned_size + total_size
Expand All @@ -117,7 +122,7 @@ def rmdir(subdir):
def rmext(subdir, extension):
fullpath = os.path.join(directory, subdir)
if not os.path.exists(fullpath):
print(f"Skipping *{extension}", " " * 26, subdir)
print("Skipping *%s" % extension, " " * 26, subdir)
return
filelist, total_size = [], 0
for dirpath, dirnames, filenames in os.walk(fullpath):
Expand All @@ -127,7 +132,8 @@ def rmext(subdir, extension):
filelist.append(fp)
total_size += os.path.getsize(fp)
print(
f"Removing {humansize(total_size):9}, {len(filelist):4d} {extension} files from {subdir}"
"Removing %9s, %4d %s files from %s"
% (humansize(total_size), len(filelist), extension, subdir)
)
for f in filelist:
os.remove(f)
Expand Down
1 change: 1 addition & 0 deletions newsfragments/1571.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix installer creation failure due to Python 3.6 syntax