Browse Source

Change some formats to f-strings

As pylint recommends.
master
fosslinux 2 months ago
parent
commit
a8a9056f1d
  1. 6
      lib/sysgeneral.py
  2. 4
      rootfs.py
  3. 4
      sysc.py

6
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)

4
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)

4
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)

Loading…
Cancel
Save