diff options
Diffstat (limited to 'app-admin/salt/files')
-rw-r--r-- | app-admin/salt/files/salt-3004.1-py310.patch | 53 | ||||
-rw-r--r-- | app-admin/salt/files/salt-3004.1-tests.patch | 20 |
2 files changed, 73 insertions, 0 deletions
diff --git a/app-admin/salt/files/salt-3004.1-py310.patch b/app-admin/salt/files/salt-3004.1-py310.patch new file mode 100644 index 000000000000..7e30d7687a66 --- /dev/null +++ b/app-admin/salt/files/salt-3004.1-py310.patch @@ -0,0 +1,53 @@ +From a58bbbe058df8f45872c43a95992f6a7a7914ab9 Mon Sep 17 00:00:00 2001 +From: piterpunk <piterpunk@slackware.com> +Date: Fri, 15 Oct 2021 11:03:20 -0300 +Subject: [PATCH] Fix _compat.py importlib logic for Python 3.10 + +Use the same logic in _compat.py and entrypoints.py to load +the same importlib.metadata. Python's built in implementation for +Python >= 3.10 and the Salt one for others. +--- + salt/_compat.py | 30 +++++++++++++++++------------- + 1 file changed, 17 insertions(+), 13 deletions(-) + +diff --git a/salt/_compat.py b/salt/_compat.py +index 8149657bea61..a402f17a3c71 100644 +--- a/salt/_compat.py ++++ b/salt/_compat.py +@@ -11,19 +11,23 @@ + else: + import salt.ext.ipaddress as ipaddress + ++if sys.version_info >= (3, 10): ++ # Python 3.10 will include a fix in importlib.metadata which allows us to ++ # get the distribution of a loaded entry-point ++ import importlib.metadata # pylint: disable=no-member,no-name-in-module ++else: ++ # importlib_metadata before version 3.3.0 does not include the functionality we need. ++ try: ++ import importlib_metadata + +-# importlib_metadata before version 3.3.0 does not include the functionality we need. +-try: +- import importlib_metadata +- +- importlib_metadata_version = [ +- int(part) +- for part in importlib_metadata.version("importlib_metadata").split(".") +- if part.isdigit() +- ] +- if tuple(importlib_metadata_version) < (3, 3, 0): ++ importlib_metadata_version = [ ++ int(part) ++ for part in importlib_metadata.version("importlib_metadata").split(".") ++ if part.isdigit() ++ ] ++ if tuple(importlib_metadata_version) < (3, 3, 0): ++ # Use the vendored importlib_metadata ++ import salt.ext.importlib_metadata as importlib_metadata ++ except ImportError: + # Use the vendored importlib_metadata + import salt.ext.importlib_metadata as importlib_metadata +-except ImportError: +- # Use the vendored importlib_metadata +- import salt.ext.importlib_metadata as importlib_metadata diff --git a/app-admin/salt/files/salt-3004.1-tests.patch b/app-admin/salt/files/salt-3004.1-tests.patch index 3a36977246f2..956cf1b0041c 100644 --- a/app-admin/salt/files/salt-3004.1-tests.patch +++ b/app-admin/salt/files/salt-3004.1-tests.patch @@ -289,3 +289,23 @@ index 907c67f477..3f68cfe8f3 100644 def test_jid_option_invalid(self): jid = salt.utils.jid.gen_jid({}) + "A" args = ["--jid", jid] + self.args +diff --git a/tests/unit/utils/test_schema.py b/tests/unit/utils/test_schema.py +index 8c648f5288..74b9bc6981 100644 +--- a/tests/unit/utils/test_schema.py ++++ b/tests/unit/utils/test_schema.py +@@ -872,6 +872,7 @@ class ConfigTestCase(TestCase): + }, + ) + ++ @skipIf(True, "Does not work in network sandbox") + @skipIf(HAS_JSONSCHEMA is False, "The 'jsonschema' library is missing") + def test_hostname_config_validation(self): + class TestConf(schema.Schema): +@@ -2098,6 +2099,7 @@ class ConfigTestCase(TestCase): + item = schema.NotItem(item=schema.BooleanItem()) + self.assertEqual(item.serialize(), {"not": item.item.serialize()}) + ++ @skipIf(True, "Does not work in network sandbox") + @skipIf(HAS_JSONSCHEMA is False, "The 'jsonschema' library is missing") + def test_not_config_validation(self): + class TestConf(schema.Schema): |