Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2020-02-04 17:46:06 +0300
committerGhostkeeper <rubend@tutanota.com>2020-02-04 17:46:06 +0300
commita1f3444271ff447e0ef194b3f017786861e483cc (patch)
treef55d48f90215cc68bce34769b16ee4c441543dc4 /plugins/VersionUpgrade/VersionUpgrade44to45
parent4307942544e3aa247783027c7d5bb2e9c1ad9aae (diff)
Don't delete containers from plugins directory
Some plug-ins provide extra profiles and we don't want to check them or delete them regardless of what their content is. Contributes to issue CURA-7024.
Diffstat (limited to 'plugins/VersionUpgrade/VersionUpgrade44to45')
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade44to45/VersionUpgrade44to45.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade44to45/VersionUpgrade44to45.py b/plugins/VersionUpgrade/VersionUpgrade44to45/VersionUpgrade44to45.py
index e40ed03bbf..48edd6faf2 100644
--- a/plugins/VersionUpgrade/VersionUpgrade44to45/VersionUpgrade44to45.py
+++ b/plugins/VersionUpgrade/VersionUpgrade44to45/VersionUpgrade44to45.py
@@ -64,10 +64,12 @@ class VersionUpgrade44to45(VersionUpgrade):
hidden_global_stacks = set() # Which global stacks have been found? We'll delete anything referred to by these. Set of stack IDs.
hidden_extruder_stacks = set() # Which extruder stacks refer to the hidden global profiles?
hidden_instance_containers = set() # Which instance containers are referred to by the hidden stacks?
+ exclude_directories = {"plugins"}
# First find all of the hidden container stacks.
data_storage = Resources.getDataStoragePath()
- for root, _, files in os.walk(data_storage):
+ for root, dirs, files in os.walk(data_storage):
+ dirs[:] = [dir for dir in dirs if dir not in exclude_directories]
for filename in fnmatch.filter(files, "*.global.cfg"):
parser = configparser.ConfigParser(interpolation = None)
parser.read(os.path.join(root, filename))
@@ -83,7 +85,8 @@ class VersionUpgrade44to45(VersionUpgrade):
os.remove(os.path.join(root, filename))
# Walk a second time to find all extruder stacks referring to these hidden container stacks.
- for root, _, files in os.walk(data_storage):
+ for root, dirs, files in os.walk(data_storage):
+ dirs[:] = [dir for dir in dirs if dir not in exclude_directories]
for filename in fnmatch.filter(files, "*.extruder.cfg"):
parser = configparser.ConfigParser(interpolation = None)
parser.read(os.path.join(root, filename))
@@ -99,7 +102,8 @@ class VersionUpgrade44to45(VersionUpgrade):
os.remove(os.path.join(root, filename))
# Walk a third time to remove all instance containers that are referred to by either of those.
- for root, _, files in os.walk(data_storage):
+ for root, dirs, files in os.walk(data_storage):
+ dirs[:] = [dir for dir in dirs if dir not in exclude_directories]
for filename in fnmatch.filter(files, "*.inst.cfg"):
container_id = urllib.parse.unquote_plus(os.path.basename(filename).split(".")[0])
if container_id in hidden_instance_containers: