[Bf-blender-cvs] [b259a8597ce] soc-2017-package_manager: Build list once

gandalf3 noreply at git.blender.org
Tue Aug 29 11:46:27 CEST 2017


Commit: b259a8597ce9b30baa654c77f0f72e5f123d4df4
Author: gandalf3
Date:   Tue Aug 29 01:54:54 2017 -0700
Branches: soc-2017-package_manager
https://developer.blender.org/rBb259a8597ce9b30baa654c77f0f72e5f123d4df4

Build list once

===================================================================

M	release/scripts/modules/bpkg/subproc.py

===================================================================

diff --git a/release/scripts/modules/bpkg/subproc.py b/release/scripts/modules/bpkg/subproc.py
index a1b3894e490..5bf1b10a44e 100644
--- a/release/scripts/modules/bpkg/subproc.py
+++ b/release/scripts/modules/bpkg/subproc.py
@@ -1,6 +1,4 @@
-"""
-All the stuff that needs to run in a subprocess.
-"""
+"""Functions to be executed in a subprocess"""
 
 from pathlib import Path
 from . import (
@@ -44,14 +42,15 @@ def uninstall_package(pipe_to_blender, package: Package, install_path: Path):
     #TODO: move package to cache and present an "undo" button to user, to give nicer UX on misclicks
 
     log = logging.getLogger(__name__ + ".uninstall_package")
+    files_to_remove = [install_path / Path(p) for p in package.files]
 
-    for pkgfile in [install_path / Path(p) for p in package.files]:
+    for pkgfile in files_to_remove:
         if not pkgfile.exists():
             pipe_to_blender.send(messages.UninstallError("Could not find file owned by package: '%s'. Refusing to uninstall." % pkgfile))
             return None
 
     try:
-        for pkgfile in [install_path / Path(p) for p in package.files]:
+        for pkgfile in files_to_remove:
             utils.rm(pkgfile)
     except Exception as err:
         pipe_to_blender.send(messages.UninstallError(err))



More information about the Bf-blender-cvs mailing list