fix deprecation warnings in regular expressions (!1804)
From https://docs.python.org/3/library/re.html "Backslashes are not handled in any special way in a string literal prefixed with 'r'." Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
This commit is contained in:
parent
2c4dae736a
commit
3b240e46f7
|
@ -357,7 +357,7 @@ def frontend(args):
|
|||
" or \"none\"")
|
||||
extra = pmb.helpers.cli.ask(args, "Extra packages", None,
|
||||
args.extra_packages,
|
||||
validation_regex="^([-.+\w]+)(,[-.+\w]+)*$")
|
||||
validation_regex=r"^([-.+\w]+)(,[-.+\w]+)*$")
|
||||
cfg["pmbootstrap"]["extra_packages"] = extra
|
||||
|
||||
# Configure timezone info
|
||||
|
|
|
@ -170,7 +170,7 @@ def configure_apk(args):
|
|||
pmb.helpers.run.root(args, ["cp", key, rootfs + "/etc/apk/keys/"])
|
||||
|
||||
# Disable pmbootstrap repository
|
||||
pmb.helpers.run.root(args, ["sed", "-i", "/\/mnt\/pmbootstrap-packages/d",
|
||||
pmb.helpers.run.root(args, ["sed", "-i", r"/\/mnt\/pmbootstrap-packages/d",
|
||||
rootfs + "/etc/apk/repositories"])
|
||||
pmb.helpers.run.user(args, ["cat", rootfs + "/etc/apk/repositories"])
|
||||
|
||||
|
@ -281,7 +281,7 @@ def setup_hostname(args):
|
|||
suffix = "rootfs_" + args.device
|
||||
pmb.chroot.root(args, ["sh", "-c", "echo " + shlex.quote(hostname) +
|
||||
" > /etc/hostname"], suffix)
|
||||
regex = ("s/^127\.0\.0\.1.*/127.0.0.1\t" + re.escape(hostname) +
|
||||
regex = (r"s/^127\.0\.0\.1.*/127.0.0.1\t" + re.escape(hostname) +
|
||||
" localhost.localdomain localhost/")
|
||||
pmb.chroot.root(args, ["sed", "-i", "-e", regex, "/etc/hosts"], suffix)
|
||||
|
||||
|
|
Loading…
Reference in New Issue