Skip to content

Commit

Permalink
Manually remove more .format() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Sep 15, 2024
1 parent 31939ff commit a896611
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/userguide/extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ a non-``None`` value. Here's an example validation function::
"""Verify that value is True, False, 0, or 1"""
if bool(value) != value:
raise SetupError(
"%r must be a boolean value (got %r)" % (attr,value)
f"{attr!r} must be a boolean value (got {value!r}"
)

Your function should accept three arguments: the ``Distribution`` object,
Expand Down
8 changes: 2 additions & 6 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,8 @@ def get_build_platform():
if sys.platform == "darwin" and not plat.startswith('macosx-'):
try:
version = _macos_vers()
machine = os.uname()[4].replace(" ", "_")
return "macosx-%d.%d-%s" % (
int(version[0]),
int(version[1]),
_macos_arch(machine),
)
machine = _macos_arch(os.uname()[4].replace(" ", "_"))
return f"macosx-{version[0]}.{version[1]}-{machine}"
except ValueError:
# if someone is running a non-Mac darwin system, this will fall
# through to the default implementation
Expand Down
14 changes: 7 additions & 7 deletions setuptools/msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,8 @@ def WindowsSDKExecutablePath(self):
else:
netfxver = 40
hidex86 = True if self.vs_ver <= 12.0 else False
arch = self.pi.current_dir(x64=True, hidex86=hidex86)
fx = 'WinSDK-NetFx%dTools%s' % (netfxver, arch.replace('\\', '-'))
arch = self.pi.current_dir(x64=True, hidex86=hidex86).replace('\\', '-')
fx = f'WinSDK-NetFx{netfxver}Tools{arch}'

# list all possibles registry paths
regpaths = []
Expand Down Expand Up @@ -836,8 +836,8 @@ def _find_dot_net_versions(self, bits):
versions
"""
# Find actual .NET version in registry
reg_ver = self.ri.lookup(self.ri.vc, 'frameworkver%d' % bits)
dot_net_dir = getattr(self, 'FrameworkDir%d' % bits)
reg_ver = self.ri.lookup(self.ri.vc, f'frameworkver{bits}')
dot_net_dir = getattr(self, f'FrameworkDir{bits}')
ver = reg_ver or self._use_last_dir_name(dot_net_dir, 'v') or ''

# Set .NET versions for specified MSVC++ version
Expand Down Expand Up @@ -1393,7 +1393,7 @@ def VCRuntimeRedist(self) -> str | None:
Returns the first suitable path found or None.
"""
vcruntime = 'vcruntime%d0.dll' % self.vc_ver
vcruntime = f'vcruntime{self.vc_ver}0.dll'
arch_subdir = self.pi.target_dir(x64=True).strip('\\')

# Installation prefixes candidates
Expand All @@ -1409,9 +1409,9 @@ def VCRuntimeRedist(self) -> str | None:

# CRT directory
crt_dirs = (
'Microsoft.VC%d.CRT' % (self.vc_ver * 10),
f'Microsoft.VC{self.vc_ver * 10}.CRT',
# Sometime store in directory with VS version instead of VC
'Microsoft.VC%d.CRT' % (int(self.vs_ver) * 10),
f'Microsoft.VC{int(self.vs_ver) * 10}.CRT',
)

# vcruntime path
Expand Down

0 comments on commit a896611

Please sign in to comment.