diff --git a/d7ed5eb59a49eaf5219c27cf93251764237ccd91.patch b/d7ed5eb59a49eaf5219c27cf93251764237ccd91.patch new file mode 100644 index 0000000..189406d --- /dev/null +++ b/d7ed5eb59a49eaf5219c27cf93251764237ccd91.patch @@ -0,0 +1,41 @@ +From d7ed5eb59a49eaf5219c27cf93251764237ccd91 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Wed, 10 Jul 2019 09:05:51 +0200 +Subject: [PATCH] Fix visiting string constants in CPython 3.8+ + +The Cura builds target CPython 3.5.2 now so it's not a problem for that, but if we upgrade to CPython 3.8 or higher in the future, or right now for the package managers in Linux, this fixes some function evaluations. + +Fixes #498. +--- + UM/Settings/SettingFunction.py | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/UM/Settings/SettingFunction.py b/UM/Settings/SettingFunction.py +index 4d6b0a0dc..48365b137 100644 +--- a/UM/Settings/SettingFunction.py ++++ b/UM/Settings/SettingFunction.py +@@ -1,4 +1,4 @@ +-# Copyright (c) 2018 Ultimaker B.V. ++# Copyright (c) 2019 Ultimaker B.V. + # Uranium is released under the terms of the LGPLv3 or higher. + + import ast +@@ -180,10 +180,18 @@ def visit_Name(self, node: ast.Name) -> None: # [CodeStyle: ast.NodeVisitor req + self.values.add(node.id) + self.keys.add(node.id) + ++ ## This one is used before Python 3.8 to visit string types. ++ # ++ # visit_Str will be marked as deprecated from Python 3.8 and onwards. + def visit_Str(self, node: ast.AST) -> None: + if node.s not in self._knownNames and node.s not in dir(builtins): # type: ignore #AST uses getattr stuff, so ignore type of node.s. + self.keys.add(node.s) # type: ignore + ++ ## This one is used on Python 3.8+ to visit string types. ++ def visit_Constant(self, node: ast.AST) -> None: ++ if isinstance(node.value, str) and node.value not in self._knownNames and node.value not in dir(builtins): # type: ignore #AST uses getattr stuff, so ignore type of node.value. ++ self.keys.add(node.value) # type: ignore ++ + _knownNames = { + "math", + "max", diff --git a/python-uranium.spec b/python-uranium.spec index 6362820..78a418e 100644 --- a/python-uranium.spec +++ b/python-uranium.spec @@ -9,6 +9,9 @@ Source0: %{url}/archive/%{version}.tar.gz#/Uranium-%{version}.tar.gz # Approximate equality in numeric tests Patch0: %{url}/pull/497.patch +# Python 3.8 fixes +Patch1: %{url}/commit/d7ed5eb59a49eaf5219c27cf93251764237ccd91.patch + BuildRequires: python3-devel BuildRequires: python3-pip BuildRequires: /usr/bin/doxygen