From 2b471c275ff4e822dd7d41acf4fcaaf1bae41741 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 19 Nov 2024 19:41:20 -0500 Subject: [PATCH 1/2] Changed the ``WindowsSdkVersion``, ``FrameworkVersion32`` and ``FrameworkVersion64`` properties of ``setuptools.msvc.PlatformInfo`` to return an empty `tuple` instead of `None` as a fallthrough case --- newsfragments/xxx.feature.rst | 1 + setuptools/msvc.py | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 newsfragments/xxx.feature.rst diff --git a/newsfragments/xxx.feature.rst b/newsfragments/xxx.feature.rst new file mode 100644 index 0000000000..2a46935eea --- /dev/null +++ b/newsfragments/xxx.feature.rst @@ -0,0 +1 @@ +Changed the ``WindowsSdkVersion``, ``FrameworkVersion32`` and ``FrameworkVersion64`` properties of ``setuptools.msvc.PlatformInfo`` to return an empty `tuple` instead of `None` as a fallthrough case -- by :user:`Avasam` diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 94c64871a6..8d6d2cf084 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -20,7 +20,7 @@ import distutils.errors if TYPE_CHECKING: - from typing_extensions import NotRequired + from typing_extensions import LiteralString, NotRequired # https://github.com/python/mypy/issues/8166 if not TYPE_CHECKING and platform.system() == 'Windows': @@ -573,7 +573,7 @@ def _guess_vc_legacy(self): return self.ri.lookup(self.ri.vc, '%0.1f' % self.vs_ver) or default_vc @property - def WindowsSdkVersion(self): + def WindowsSdkVersion(self) -> tuple[LiteralString, ...]: """ Microsoft Windows SDK versions for specified MSVC++ version. @@ -592,7 +592,7 @@ def WindowsSdkVersion(self): return '8.1', '8.1a' elif self.vs_ver >= 14.0: return '10.0', '8.1' - return None + return () @property def WindowsSdkLastVersion(self): @@ -800,7 +800,7 @@ def FrameworkDir64(self): return self.ri.lookup(self.ri.vc, 'frameworkdir64') or guess_fw @property - def FrameworkVersion32(self): + def FrameworkVersion32(self) -> tuple[str, ...]: """ Microsoft .NET Framework 32bit versions. @@ -812,7 +812,7 @@ def FrameworkVersion32(self): return self._find_dot_net_versions(32) @property - def FrameworkVersion64(self): + def FrameworkVersion64(self) -> tuple[str, ...]: """ Microsoft .NET Framework 64bit versions. @@ -823,7 +823,7 @@ def FrameworkVersion64(self): """ return self._find_dot_net_versions(64) - def _find_dot_net_versions(self, bits): + def _find_dot_net_versions(self, bits) -> tuple[str, ...]: """ Find Microsoft .NET Framework versions. @@ -851,7 +851,7 @@ def _find_dot_net_versions(self, bits): return 'v3.5', 'v2.0.50727' elif self.vs_ver == 8.0: return 'v3.0', 'v2.0.50727' - return None + return () @staticmethod def _use_last_dir_name(path, prefix=''): From 50d671b1e4ca090affe57d3a95b2ad7fa43c0e27 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Wed, 20 Nov 2024 13:41:34 +0000 Subject: [PATCH 2/2] Rename news fragment --- newsfragments/{xxx.feature.rst => 4754.feature.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename newsfragments/{xxx.feature.rst => 4754.feature.rst} (100%) diff --git a/newsfragments/xxx.feature.rst b/newsfragments/4754.feature.rst similarity index 100% rename from newsfragments/xxx.feature.rst rename to newsfragments/4754.feature.rst