Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty tuple instead of None for PlatformInfo version properties fallthrough #4754

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`
abravalheri marked this conversation as resolved.
Show resolved Hide resolved
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
Loading