File 9105.patch of Package cura
From 352fef3efa700b53f308a095c5faa85520d9a4c1 Mon Sep 17 00:00:00 2001
From: Philip Lorenz <philip@bithub.de>
Date: Sun, 10 Jan 2021 20:21:40 +0100
Subject: [PATCH] Adapt to Python 3.9 API changes
Python 3.9 now made the TreeBuilder.start() `attrs` parameter ([1])
mandatory on all implementations. Adapt the plugin accordingly.
[1] https://bugs.python.org/issue39495
---
.../XmlMaterialProfile/XmlMaterialProfile.py | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py
index 70e702d0bf4..ce0bb06d8d6 100644
--- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py
+++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py
@@ -151,7 +151,7 @@ def serialize(self, ignored_metadata_keys: Optional[Set[str]] = None):
"version": self.CurrentFdmMaterialVersion})
## Begin Metadata Block
- builder.start("metadata") # type: ignore
+ builder.start("metadata", {}) # type: ignore
metadata = copy.deepcopy(self.getMetaData())
# setting_version is derived from the "version" tag in the schema, so don't serialize it into a file
@@ -165,21 +165,21 @@ def serialize(self, ignored_metadata_keys: Optional[Set[str]] = None):
properties = metadata.pop("properties", {})
## Begin Name Block
- builder.start("name") # type: ignore
+ builder.start("name", {}) # type: ignore
- builder.start("brand") # type: ignore
+ builder.start("brand", {}) # type: ignore
builder.data(metadata.pop("brand", ""))
builder.end("brand")
- builder.start("material") # type: ignore
+ builder.start("material", {}) # type: ignore
builder.data(metadata.pop("material", ""))
builder.end("material")
- builder.start("color") # type: ignore
+ builder.start("color", {}) # type: ignore
builder.data(metadata.pop("color_name", ""))
builder.end("color")
- builder.start("label") # type: ignore
+ builder.start("label", {}) # type: ignore
builder.data(self.getName())
builder.end("label")
@@ -190,7 +190,7 @@ def serialize(self, ignored_metadata_keys: Optional[Set[str]] = None):
key_to_use = key
if key in self._metadata_tags_that_have_cura_namespace:
key_to_use = "cura:" + key_to_use
- builder.start(key_to_use) # type: ignore
+ builder.start(key_to_use, {}) # type: ignore
if value is not None: #Nones get handled well by the builder.
#Otherwise the builder always expects a string.
#Deserialize expects the stringified version.
@@ -202,10 +202,10 @@ def serialize(self, ignored_metadata_keys: Optional[Set[str]] = None):
## End Metadata Block
## Begin Properties Block
- builder.start("properties") # type: ignore
+ builder.start("properties", {}) # type: ignore
for key, value in properties.items():
- builder.start(key) # type: ignore
+ builder.start(key, {}) # type: ignore
builder.data(value)
builder.end(key)
@@ -213,7 +213,7 @@ def serialize(self, ignored_metadata_keys: Optional[Set[str]] = None):
## End Properties Block
## Begin Settings Block
- builder.start("settings") # type: ignore
+ builder.start("settings", {}) # type: ignore
if self.getMetaDataEntry("definition") == "fdmprinter":
for instance in self.findInstances():
@@ -258,7 +258,7 @@ def serialize(self, ignored_metadata_keys: Optional[Set[str]] = None):
product = product_name
break
- builder.start("machine") # type: ignore
+ builder.start("machine", {}) # type: ignore
builder.start("machine_identifier", {
"manufacturer": container.getMetaDataEntry("machine_manufacturer",
definition_metadata.get("manufacturer", "Unknown")),