Skip to content

Commit

Permalink
Changed the WindowsSdkVersion, FrameworkVersion32 and ``Frame…
Browse files Browse the repository at this point in the history
…workVersion64`` properties of ``setuptools.msvc.PlatformInfo`` to return an empty `tuple` instead of `None` as a fallthrough case
  • Loading branch information
Avasam committed Nov 20, 2024
1 parent 2c77cd2 commit 2b471c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions newsfragments/xxx.feature.rst
Original file line number Diff line number Diff line change
@@ -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`
14 changes: 7 additions & 7 deletions setuptools/msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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.
Expand All @@ -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):
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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=''):
Expand Down

0 comments on commit 2b471c2

Please sign in to comment.