commit: a8a9056f1d8676f9863834c800d2f6b073e21cb0
parent 8857f53cd1a3347998b4a209e8c075af2ec0180f
Author: fosslinux <fosslinux@aussies.space>
Date: Mon, 20 Sep 2021 14:31:10 +1000
Change some formats to f-strings
As pylint recommends.
Diffstat:
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/sysgeneral.py b/lib/sysgeneral.py
@@ -33,7 +33,7 @@ class SysGeneral:
def __del__(self):
if not self.preserve_tmp:
- print("Unmounting tmpfs from %s" % (self.tmp_dir))
+ print(f"Unmounting tmpfs from {self.tmp_dir}")
umount(self.tmp_dir)
os.rmdir(self.tmp_dir)
@@ -41,7 +41,7 @@ class SysGeneral:
"""Mount the tmpfs for this sysx"""
if not os.path.isdir(self.tmp_dir):
os.mkdir(self.tmp_dir)
- print("Mounting tmpfs on %s" % (self.tmp_dir))
+ print(f"Mounting tmpfs on {self.tmp_dir}")
mount('tmpfs', self.tmp_dir, 'tmpfs', 'size=8G')
def check_file(self, file_name):
@@ -80,7 +80,7 @@ class SysGeneral:
# Actually download the file
if not os.path.isfile(abs_file_name):
- print("Downloading: %s" % (file_name))
+ print(f"Downloading: {file_name}")
request = requests.get(url, allow_redirects=True)
# pylint: disable=consider-using-with
open(abs_file_name, 'wb').write(request.content)
diff --git a/rootfs.py b/rootfs.py
@@ -81,7 +81,7 @@ def main():
def bootstrap(args, system_a, system_b, system_c):
"""Kick off bootstrap process."""
- print("Bootstrapping %s -- SysA" % (args.arch))
+ print(f"Bootstrapping {args.arch} -- SysA")
if args.chroot:
find_chroot = """
import shutil
@@ -97,7 +97,7 @@ print(shutil.which('chroot'))
# We skip sysb as that is only pertinent to "hardware" (not chroot)
system_c.chroot_transition(system_a.tmp_dir)
# sysc
- print("Bootstrapping %s -- SysC" % (args.arch))
+ print(f"Bootstrapping {args.arch} -- SysC")
init = os.path.join(os.sep, 'init')
run('sudo', chroot_binary, system_c.tmp_dir, init)
diff --git a/sysc.py b/sysc.py
@@ -35,9 +35,9 @@ class SysC(SysGeneral):
def __del__(self):
if not self.preserve_tmp:
if not self.chroot:
- print("Deleting %s" % (self.dev_name))
+ print(f"Deleting {self.dev_name}")
run('sudo', 'losetup', '-d', self.dev_name)
- print("Unmounting tmpfs from %s" % (self.tmp_dir))
+ print(f"Unmounting tmpfs from {self.tmp_dir}")
umount(self.tmp_dir)
os.rmdir(self.tmp_dir)