summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7a5091a)
Fix:
| W605 invalid escape sequence '\s'
by using re.compile(r'...') instead of re.compile("...")
Fix:
| E261 at least two spaces before inline comment
introduced in commit
ed5b633be961ef6b3
Fix flake8 issues:
| grml2usb:409:5: F841 local variable 'e' is assigned to but never used
| grml2usb:557:34: W504 line break after binary operator
| grml2usb:559:34: W504 line break after binary operator
| grml2usb:737:37: W504 line break after binary operator
| grml2usb:1615:13: F841 local variable 'error' is assigned to but never used
| grml2usb:1641:9: F841 local variable 'error' is assigned to but never used
| grml2usb:1665:5: F841 local variable 'error' is assigned to but never used
| grml2usb:1826:30: W504 line break after binary operator
| grml2usb:1832:30: W504 line break after binary operator
The https://www.flake8rules.com/rules/W503.html vs
https://www.flake8rules.com/rules/W504.html is strange,
though let's use what black(1) (see https://github.com/psf/black)
uses.
GRML_DEFAULT = None
UUID = None
SYSLINUX_LIBS = [
GRML_DEFAULT = None
UUID = None
SYSLINUX_LIBS = [
- "/usr/lib/syslinux/modules/bios/", # Debian
- "/usr/lib/syslinux/bios/", # Arch Linux
+ "/usr/lib/syslinux/modules/bios/", # Debian
+ "/usr/lib/syslinux/bios/", # Arch Linux
]
GPT_HEADER = b"\x55\xaa\x45\x46\x49\x20\x50\x41\x52\x54" # original GPT header
GRUB_INSTALL = None
]
GPT_HEADER = b"\x55\xaa\x45\x46\x49\x20\x50\x41\x52\x54" # original GPT header
GRUB_INSTALL = None
return
except HodorException as e:
logging.info("%s, falling back to old bootflag detection", e)
return
except HodorException as e:
logging.info("%s, falling back to old bootflag detection", e)
- except ImportError as e:
logging.debug("could not import parted, falling back to old bootflag detection")
with open(boot_dev, 'rb') as image:
logging.debug("could not import parted, falling back to old bootflag detection")
with open(boot_dev, 'rb') as image:
if proc.returncode != 0:
# raise Exception("error executing grub-install")
if proc.returncode != 0:
# raise Exception("error executing grub-install")
- logging.critical("Fatal: error executing grub-install " +
+ logging.critical("Fatal: error executing grub-install "
"(please check the grml2usb FAQ or drop the --grub option)")
"(please check the grml2usb FAQ or drop the --grub option)")
- logging.critical("Note: if using grub2 consider using " +
+ logging.critical("Note: if using grub2 consider using "
"the --grub-mbr option as grub considers PBR problematic.")
cleanup()
sys.exit(1)
"the --grub-mbr option as grub considers PBR problematic.")
cleanup()
sys.exit(1)
for x in open('/proc/mounts', 'r').readlines():
if x.startswith(source):
for x in open('/proc/mounts', 'r').readlines():
if x.startswith(source):
- raise CriticalException("Error executing mount: %s already mounted - " % source +
- "please unmount before invoking grml2usb")
+ raise CriticalException(("Error executing mount: %s already mounted - "
+ "please unmount before invoking grml2usb").format(source))
if os.path.isdir(source):
logging.debug("Source %s is not a device, therefore not mounting.", source)
if os.path.isdir(source):
logging.debug("Source %s is not a device, therefore not mounting.", source)
grub_target = target + '/boot/grub/'
secureboot_target = target + '/EFI/ubuntu/'
grub_target = target + '/boot/grub/'
secureboot_target = target + '/EFI/ubuntu/'
- bootid_re = re.compile("bootid=[\w_-]+")
- live_media_path_re = re.compile("live-media-path=[\w_/-]+")
+ bootid_re = re.compile(r'bootid=[\w_-]+')
+ live_media_path_re = re.compile(r'live-media-path=[\w_/-]+')
bootopt = get_bootoptions(grml_flavour)
bootopt = get_bootoptions(grml_flavour)
@flavour: grml flavour
"""
@flavour: grml flavour
"""
- append_re = re.compile("^(\s*append.*/boot/.*)$", re.I)
+ append_re = re.compile(r'^(\s*append.*/boot/.*)$', re.I)
# flavour_re = re.compile("(label.*)(grml\w+)")
# flavour_re = re.compile("(label.*)(grml\w+)")
- default_re = re.compile("(default.cfg)")
- bootid_re = re.compile("bootid=[\w_-]+")
- live_media_path_re = re.compile("live-media-path=[\w_/-]+")
+ default_re = re.compile(r'(default.cfg)')
+ bootid_re = re.compile(r'bootid=[\w_-]+')
+ live_media_path_re = re.compile(r'live-media-path=[\w_/-]+')
bootopt = get_bootoptions(flavour)
bootopt = get_bootoptions(flavour)
"""Adjust the specified labels in the syslinux config file src with
specified replacement
"""
"""Adjust the specified labels in the syslinux config file src with
specified replacement
"""
- label_re = re.compile("^(\s*label\s*) ([a-zA-Z0-9_-]+)", re.I)
+ label_re = re.compile(r'^(\s*label\s*) ([a-zA-Z0-9_-]+)', re.I)
for line in fileinput.input(src, inplace=1):
line = label_re.sub(replacement, line)
sys.stdout.write(line)
for line in fileinput.input(src, inplace=1):
line = label_re.sub(replacement, line)
sys.stdout.write(line)
@filename: syslinux config file
"""
@filename: syslinux config file
"""
- default_re = re.compile("^(\s*menu\s*default\s*)$", re.I)
+ default_re = re.compile(r'^(\s*menu\s*default\s*)$', re.I)
for line in fileinput.input(filename, inplace=1):
if default_re.match(line):
continue
for line in fileinput.input(filename, inplace=1):
if default_re.match(line):
continue
if remove_image_mountpoint:
try:
remove_mountpoint(iso_mountpoint)
if remove_image_mountpoint:
try:
remove_mountpoint(iso_mountpoint)
- except CriticalException as error:
+ except CriticalException:
set_rw(device)
mount(device, device_mountpoint, ['-o', 'utf8,iocharset=iso8859-1'])
set_rw(device)
mount(device, device_mountpoint, ['-o', 'utf8,iocharset=iso8859-1'])
- except CriticalException as error:
+ except CriticalException:
mount(device, device_mountpoint, "")
try:
grml_flavours = identify_grml_flavour(mountpoint)
mount(device, device_mountpoint, "")
try:
grml_flavours = identify_grml_flavour(mountpoint)
if os.path.isdir(mountpoint):
os.rmdir(mountpoint)
unregister_tmpfile(mountpoint)
if os.path.isdir(mountpoint):
os.rmdir(mountpoint)
unregister_tmpfile(mountpoint)
- except CriticalException as error:
+ except CriticalException:
global GRUB_INSTALL
GRUB_INSTALL = which("grub-install") or which("grub2-install")
if not GRUB_INSTALL:
global GRUB_INSTALL
GRUB_INSTALL = which("grub-install") or which("grub2-install")
if not GRUB_INSTALL:
- logging.critical("Fatal: grub-install not available (please install the " +
+ logging.critical("Fatal: grub-install not available (please install the "
"grub package or drop the --grub option)")
sys.exit(1)
if options.syslinux:
if not which("syslinux"):
"grub package or drop the --grub option)")
sys.exit(1)
if options.syslinux:
if not which("syslinux"):
- logging.critical("Fatal: syslinux not available (please install the " +
+ logging.critical("Fatal: syslinux not available (please install the "
"syslinux package or use the --grub option)")
sys.exit(1)
"syslinux package or use the --grub option)")
sys.exit(1)