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@true.cz>
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
))