Skip to content

Commit

Permalink
phase2: fix invalid escape sequence flake8 warning in checksums step
Browse files Browse the repository at this point in the history
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: f0faed2 ("phase2: compute checksums")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
  • Loading branch information
ynezz committed Dec 24, 2023
1 parent a67d932 commit 03abd02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion phase2/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
))

Expand Down

0 comments on commit 03abd02

Please sign in to comment.