[buildbot] phase2: fix invalid escape sequence flake8 warning in checksums step

LEDE Commits lede-commits at lists.infradead.org
Fri Apr 12 23:33:03 PDT 2024


ynezz pushed a commit to buildbot.git, branch main:
https://git.openwrt.org/f02393e0f7ed923664ef52644b48ad95fa70d55e

commit f02393e0f7ed923664ef52644b48ad95fa70d55e
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Sat Dec 23 07:33:21 2023 +0000

    phase2: fix invalid escape sequence flake8 warning in checksums step
    
    Resolved a flake8 linting warning related to an invalid escape sequence
    in the ShellCommand for calculating checksums:
    
     phase2/master.cfg:739:28: W605 invalid escape sequence '\('
     phase2/master.cfg:739:32: W605 invalid escape sequence '\)'
     phase2/master.cfg:739:35: W605 invalid escape sequence '\('
     phase2/master.cfg:739:39: W605 invalid escape sequence '\)'
    
    The warning was caused by the use of unescaped parentheses in a regular
    expression within a sed command.
    
    Use a raw string (with an 'r' prefix) to treat backslashes as literal
    characters, ensuring that the regular expression is correctly
    interpreted and flake8 does not raise a warning.
    
    This fix ensures that the code adheres to Python's string handling best
    practices and maintains the integrity of the regular expression
    functionality.
    
    Fixes: f0faed2970dd ("phase2: compute checksums")
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 phase2/master.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/phase2/master.cfg b/phase2/master.cfg
index fa585d7..deebc28 100644
--- a/phase2/master.cfg
+++ b/phase2/master.cfg
@@ -575,7 +575,7 @@ for arch in arches:
 		command = "cd bin/packages/%s; " %(arch[0])
 		+ "find . -type f -not -name 'sha256sums' -printf \"%P\n\" | "
 		+ "sort | xargs -r ../../../staging_dir/host/bin/mkhash -n sha256 | "
-		+ "sed -ne 's!^\(.*\) \(.*\)$!\1 *\2!p' > sha256sums",
+		+ r"sed -ne 's!^\(.*\) \(.*\)$!\1 *\2!p' > sha256sums",
 		haltOnFailure = True
 	))
 




More information about the lede-commits mailing list