From: Michael Tremer Date: Thu, 1 Dec 2022 22:20:52 +0000 (+0000) Subject: kernel: Port scripts to Python 3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e42c2c0bc27db839e8be371023d08c73bcc2602f;p=ipfire-3.x.git kernel: Port scripts to Python 3 Signed-off-by: Michael Tremer --- diff --git a/kernel/kernel.nm b/kernel/kernel.nm index 683982528..b2e2e26c2 100644 --- a/kernel/kernel.nm +++ b/kernel/kernel.nm @@ -49,6 +49,7 @@ build newt-devel pciutils-devel perl + python3 python-devel rsync openssl-devel diff --git a/kernel/scripts/configcommon.py b/kernel/scripts/configcommon.py old mode 100755 new mode 100644 index 003b562ec..165ab5938 --- a/kernel/scripts/configcommon.py +++ b/kernel/scripts/configcommon.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 ############################################################################### # IPFire.org - An Open Source Firewall Solution # # Copyright (C) - IPFire Development Team # @@ -62,15 +62,15 @@ for line in lines: m = re.match("^# (.*) is not set$", line) if m: if options_counter.get("%s=n" % m.group(1), 0) == len(filelist): - print "# %s is not set" % m.group(1) + print("# %s is not set" % m.group(1)) continue m = re.match("^(.*)=(.*)$", line) if m: if options_counter.get(m.group(0), 0) == len(filelist): - print m.group(0) + print(m.group(0)) continue - print line + print(line) diff --git a/kernel/scripts/configdiff.py b/kernel/scripts/configdiff.py old mode 100755 new mode 100644 index ef938666a..044639b2f --- a/kernel/scripts/configdiff.py +++ b/kernel/scripts/configdiff.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 ############################################################################### # IPFire.org - An Open Source Firewall Solution # # Copyright (C) - IPFire Development Team # @@ -57,7 +57,7 @@ for line in f.readlines(): _section = m.group(1) if _section in printed_sections: - print "# end of %s" % _section + print("# end of %s" % _section) continue @@ -91,15 +91,15 @@ for line in f.readlines(): option_value = "%s=%s" % (option, value) if not option_value in options: if section and not section in printed_sections: - print - print "#" - print "# %s" % section - print "#" + print() + print("#") + print("# %s" % section) + print("#") printed_sections.append(section) if value == "n": - print "# %s is not set" % option + print("# %s is not set" % option) else: - print "%s=%s" % (option, value) + print("%s=%s" % (option, value)) f.close() diff --git a/kernel/scripts/configure b/kernel/scripts/configure index b2c1fa371..15b9d9bf9 100644 --- a/kernel/scripts/configure +++ b/kernel/scripts/configure @@ -193,7 +193,7 @@ function make_config() { popd ) - ${SCRIPTS_DIR}/configdiff.py ${config_in} ${config_out} > ${diff_out} + python3 ${SCRIPTS_DIR}/configdiff.py ${config_in} ${config_out} > ${diff_out} # Update the rest of the configurations. diff_configs ${diff_out} --mode=oldconfig @@ -240,30 +240,30 @@ function diff_configs() { for platform in ${PLATFORMS}; do for subplatform in ${SUBPLATFORMS[${platform}]}; do filename="${tmpdir}/config-${subplatform}-common" - ${SCRIPTS_DIR}/configcommon.py ${subplatform_configs[${subplatform}]} \ + python3 ${SCRIPTS_DIR}/configcommon.py ${subplatform_configs[${subplatform}]} \ > ${filename} platform_configs[${platform}]="${platform_configs[${platform}]} ${filename}" done filename="${tmpdir}/config-${platform}-common" - ${SCRIPTS_DIR}/configcommon.py ${platform_configs[${platform}]} \ + python3 ${SCRIPTS_DIR}/configcommon.py ${platform_configs[${platform}]} \ > ${filename} common_configs="${common_configs} ${filename}" done - ${SCRIPTS_DIR}/configcommon.py ${common_configs} > ${tmpdir}/config-generic + python3 ${SCRIPTS_DIR}/configcommon.py ${common_configs} > ${tmpdir}/config-generic for platform in ${PLATFORMS}; do for subplatform in ${SUBPLATFORMS[${platform}]}; do - ${SCRIPTS_DIR}/configdiff.py \ + python3 ${SCRIPTS_DIR}/configdiff.py \ ${tmpdir}/config-${platform}-common \ ${tmpdir}/config-${subplatform}-common \ > ${tmpdir}/config-${subplatform}-generic done - ${SCRIPTS_DIR}/configdiff.py \ + python3 ${SCRIPTS_DIR}/configdiff.py \ ${tmpdir}/config-generic \ ${tmpdir}/config-${platform}-common \ > ${tmpdir}/config-${platform}-generic @@ -283,7 +283,7 @@ function diff_configs() { ;; *) platform="$(get_subplatform "${arch}" || get_platform "${arch}")" - ${SCRIPTS_DIR}/configdiff.py ${tmpdir}/config-${platform}-common \ + python3 ${SCRIPTS_DIR}/configdiff.py ${tmpdir}/config-${platform}-common \ ${filename} > ${filename}.tmp ;; esac