rmlint
rmlint copied to clipboard
SyntaxWarning: invalid escape sequence
If scons uses python 3.12 or later, these warnings appear:
scons: Reading SConscript files ...
SConstruct:839: SyntaxWarning: invalid escape sequence '\.'
'sed -i "s/2\.0\.0/{v}/g" po/rmlint.pot',
SConstruct:840: SyntaxWarning: invalid escape sequence '\('
'sed -i "s/^Version:\(\s*\)2\.0\.0/Version:\\1{v}/g" pkg/fedora/rmlint.spec'
See https://docs.python.org/3/library/re.html:
The solution is to use Python’s raw string notation for regular expression patterns; backslashes are not handled in any special way in a string literal prefixed with
'r'. Sor"\n"is a two-character string containing'\'and'n', while"\n"is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw string notation.