Skip to content

Commit f65ea5b

Browse files
Manually remove more %-formatting
1 parent 35365c6 commit f65ea5b

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

docs/userguide/extension.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ a non-``None`` value. Here's an example validation function::
122122
"""Verify that value is True, False, 0, or 1"""
123123
if bool(value) != value:
124124
raise SetupError(
125-
"%r must be a boolean value (got %r)" % (attr,value)
125+
f"{attr!r} must be a boolean value (got {value!r}"
126126
)
127127

128128
Your function should accept three arguments: the ``Distribution`` object,

pkg_resources/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,8 @@ def get_build_platform():
451451
if sys.platform == "darwin" and not plat.startswith('macosx-'):
452452
try:
453453
version = _macos_vers()
454-
machine = os.uname()[4].replace(" ", "_")
455-
return "macosx-%d.%d-%s" % (
456-
int(version[0]),
457-
int(version[1]),
458-
_macos_arch(machine),
459-
)
454+
machine = _macos_arch(os.uname()[4].replace(" ", "_"))
455+
return f"macosx-{version[0]}.{version[1]}-{machine}"
460456
except ValueError:
461457
# if someone is running a non-Mac darwin system, this will fall
462458
# through to the default implementation

setuptools/msvc.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,8 @@ def WindowsSDKExecutablePath(self):
667667
else:
668668
netfxver = 40
669669
hidex86 = True if self.vs_ver <= 12.0 else False
670-
arch = self.pi.current_dir(x64=True, hidex86=hidex86)
671-
fx = 'WinSDK-NetFx%dTools%s' % (netfxver, arch.replace('\\', '-'))
670+
arch = self.pi.current_dir(x64=True, hidex86=hidex86).replace('\\', '-')
671+
fx = f'WinSDK-NetFx{netfxver}Tools{arch}'
672672

673673
# list all possibles registry paths
674674
regpaths = []
@@ -839,8 +839,8 @@ def _find_dot_net_versions(self, bits) -> tuple[str, ...]:
839839
versions
840840
"""
841841
# Find actual .NET version in registry
842-
reg_ver = self.ri.lookup(self.ri.vc, 'frameworkver%d' % bits)
843-
dot_net_dir = getattr(self, 'FrameworkDir%d' % bits)
842+
reg_ver = self.ri.lookup(self.ri.vc, f'frameworkver{bits}')
843+
dot_net_dir = getattr(self, f'FrameworkDir{bits}')
844844
ver = reg_ver or self._use_last_dir_name(dot_net_dir, 'v') or ''
845845

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

14101410
# Installation prefixes candidates
@@ -1420,9 +1420,9 @@ def VCRuntimeRedist(self) -> str | None:
14201420

14211421
# CRT directory
14221422
crt_dirs = (
1423-
'Microsoft.VC%d.CRT' % (self.vc_ver * 10),
1423+
f'Microsoft.VC{self.vc_ver * 10}.CRT',
14241424
# Sometime store in directory with VS version instead of VC
1425-
'Microsoft.VC%d.CRT' % (int(self.vs_ver) * 10),
1425+
f'Microsoft.VC{int(self.vs_ver) * 10}.CRT',
14261426
)
14271427

14281428
# vcruntime path

0 commit comments

Comments
 (0)