From 5767ad6673f453cd4b26b03f704a8f88fc9b5c5a Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 19 Nov 2024 19:41:20 -0500 Subject: [PATCH] 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 00000000000..2a46935eea6 --- /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 6492d3be9d0..f0ab06cdb7e 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=''):