summaryrefslogtreecommitdiff
path: root/src/wheel/cli
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2021-12-22 16:30:41 +0200
committerAlex Grönholm <alex.gronholm@nextday.fi>2021-12-22 16:30:41 +0200
commitfa4de8bd7dce1611be217ade3aade0bd8c76ca7a (patch)
tree621e55e88d3861bea1dc2c42ea0eae87b5930b89 /src/wheel/cli
parent45af6b0f420b7a90af417b3846b0bdfe1c6a70d4 (diff)
downloadwheel-git-fa4de8bd7dce1611be217ade3aade0bd8c76ca7a.tar.gz
Upgraded to py3.7+ syntax
Diffstat (limited to 'src/wheel/cli')
-rw-r--r--src/wheel/cli/__init__.py2
-rwxr-xr-xsrc/wheel/cli/convert.py10
-rw-r--r--src/wheel/cli/pack.py8
-rw-r--r--src/wheel/cli/unpack.py2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/wheel/cli/__init__.py b/src/wheel/cli/__init__.py
index d41dcfd..c8a3b35 100644
--- a/src/wheel/cli/__init__.py
+++ b/src/wheel/cli/__init__.py
@@ -11,7 +11,7 @@ def require_pkgresources(name):
try:
import pkg_resources # noqa: F401
except ImportError:
- raise RuntimeError("'{0}' needs pkg_resources (part of setuptools).".format(name))
+ raise RuntimeError(f"'{name}' needs pkg_resources (part of setuptools).")
class WheelError(Exception):
diff --git a/src/wheel/cli/convert.py b/src/wheel/cli/convert.py
index b502daf..5c76d5f 100755
--- a/src/wheel/cli/convert.py
+++ b/src/wheel/cli/convert.py
@@ -37,7 +37,7 @@ def egg2wheel(egg_path, dest_dir):
filename = os.path.basename(egg_path)
match = egg_info_re.match(filename)
if not match:
- raise WheelError('Invalid egg file name: {}'.format(filename))
+ raise WheelError(f'Invalid egg file name: {filename}')
egg_info = match.groupdict()
dir = tempfile.mkdtemp(suffix="_e2w")
@@ -124,13 +124,13 @@ def parse_wininst_info(wininfo_name, egginfo_name):
if egginfo_name:
egginfo = egg_info_re.search(egginfo_name)
if not egginfo:
- raise ValueError("Egg info filename %s is not valid" % (egginfo_name,))
+ raise ValueError(f"Egg info filename {egginfo_name} is not valid")
# Parse the wininst filename
# 1. Distribution name (up to the first '-')
w_name, sep, rest = wininfo_name.partition('-')
if not sep:
- raise ValueError("Installer filename %s is not valid" % (wininfo_name,))
+ raise ValueError(f"Installer filename {wininfo_name} is not valid")
# Strip '.exe'
rest = rest[:-4]
@@ -149,7 +149,7 @@ def parse_wininst_info(wininfo_name, egginfo_name):
# 3. Version and architecture
w_ver, sep, w_arch = rest.rpartition('.')
if not sep:
- raise ValueError("Installer filename %s is not valid" % (wininfo_name,))
+ raise ValueError(f"Installer filename {wininfo_name} is not valid")
if egginfo:
w_name = egginfo.group('name')
@@ -260,7 +260,7 @@ def convert(files, dest_dir, verbose):
conv = wininst2wheel
if verbose:
- print("{}... ".format(installer), flush=True)
+ print(f"{installer}... ", flush=True)
conv(installer, dest_dir)
if verbose:
diff --git a/src/wheel/cli/pack.py b/src/wheel/cli/pack.py
index 04d858d..094eb67 100644
--- a/src/wheel/cli/pack.py
+++ b/src/wheel/cli/pack.py
@@ -21,9 +21,9 @@ def pack(directory, dest_dir, build_number):
dist_info_dirs = [fn for fn in os.listdir(directory)
if os.path.isdir(os.path.join(directory, fn)) and DIST_INFO_RE.match(fn)]
if len(dist_info_dirs) > 1:
- raise WheelError('Multiple .dist-info directories found in {}'.format(directory))
+ raise WheelError(f'Multiple .dist-info directories found in {directory}')
elif not dist_info_dirs:
- raise WheelError('No .dist-info directories found in {}'.format(directory))
+ raise WheelError(f'No .dist-info directories found in {directory}')
# Determine the target wheel filename
dist_info_dir = dist_info_dirs[0]
@@ -70,9 +70,9 @@ def pack(directory, dest_dir, build_number):
tagline = '-'.join(['.'.join(impls), '.'.join(abivers), '.'.join(platforms)])
# Repack the wheel
- wheel_path = os.path.join(dest_dir, '{}-{}.whl'.format(name_version, tagline))
+ wheel_path = os.path.join(dest_dir, f'{name_version}-{tagline}.whl')
with WheelFile(wheel_path, 'w') as wf:
- print("Repacking wheel as {}...".format(wheel_path), end='', flush=True)
+ print(f"Repacking wheel as {wheel_path}...", end='', flush=True)
wf.write_files(directory)
print('OK')
diff --git a/src/wheel/cli/unpack.py b/src/wheel/cli/unpack.py
index 8aa8180..3f3963c 100644
--- a/src/wheel/cli/unpack.py
+++ b/src/wheel/cli/unpack.py
@@ -15,7 +15,7 @@ def unpack(path, dest='.'):
with WheelFile(path) as wf:
namever = wf.parsed_filename.group('namever')
destination = os.path.join(dest, namever)
- print("Unpacking to: {}...".format(destination), end='', flush=True)
+ print(f"Unpacking to: {destination}...", end='', flush=True)
wf.extractall(destination)
print('OK')