Skip to content

Commit 2e10c29

Browse files
Manually remove more %-formatting
1 parent 525d72a commit 2e10c29

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
@@ -456,12 +456,8 @@ def get_build_platform():
456456
if sys.platform == "darwin" and not plat.startswith('macosx-'):
457457
try:
458458
version = _macos_vers()
459-
machine = os.uname()[4].replace(" ", "_")
460-
return "macosx-%d.%d-%s" % (
461-
int(version[0]),
462-
int(version[1]),
463-
_macos_arch(machine),
464-
)
459+
machine = _macos_arch(os.uname()[4].replace(" ", "_"))
460+
return f"macosx-{version[0]}.{version[1]}-{machine}"
465461
except ValueError:
466462
# if someone is running a non-Mac darwin system, this will fall
467463
# through to the default implementation

setuptools/msvc.py

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

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

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

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

14101410
# CRT directory
14111411
crt_dirs = (
1412-
'Microsoft.VC%d.CRT' % (self.vc_ver * 10),
1412+
f'Microsoft.VC{self.vc_ver * 10}.CRT',
14131413
# Sometime store in directory with VS version instead of VC
1414-
'Microsoft.VC%d.CRT' % (int(self.vs_ver) * 10),
1414+
f'Microsoft.VC{int(self.vs_ver) * 10}.CRT',
14151415
)
14161416

14171417
# vcruntime path

0 commit comments

Comments
 (0)