Update regex matching to handle proper class escaping#19
Update regex matching to handle proper class escaping#19warthog9 wants to merge 1 commit intoenarx:masterfrom
Conversation
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
On Python 3.12 it's throwing compile warnings on the regex compiles:
```
spdx/verify-spdx-headers:8: SyntaxWarning: invalid escape sequence '\s'
SPDX = re.compile(f'SPDX-License-Identifier:\s+({SLUG.pattern})')
spdx/verify-spdx-headers:21: SyntaxWarning: invalid escape sequence '\s'
pattern = f"^{init}\s*{SPDX.pattern}\s*{fini}\\s*$"
spdx/verify-spdx-headers:21: SyntaxWarning: invalid escape sequence '\s'
pattern = f"^{init}\s*{SPDX.pattern}\s*{fini}\s*$"
```
This escapes the the '\s' to be '\\s' instead as that is compliant,
seems to compile correctly, and makes the warning go away. Quick
checking on my own repos seemed to not break anything.
Signed-off-by: John 'Warthog9' Hawley <jhawley@tenstorrent.com>
Head branch was pushed to by a user without write access
|
Possibly a dumb question, but what version of Python runs on Github's CI runners? |
|
Depends on the image used, since each image has a different base it could be used with, and the image bases will shift slowly over time as Github upgrades them. I believe the current default is Ubuntu 22.04, but I haven't found an absolutely definitive answer to that. In my specific case I'm running the checker outside the action itself on a Fedora 39 system, which has a newer Python, and running into the problem likely slightly ahead of when the default image for Github upgrades to a 3.12 base Python. |
On Python 3.12 it's throwing compile warnings on the regex compiles:
This escapes the the '\s' to be '\s' instead as that is compliant, seems to compile correctly, and makes the warning go away. Quick checking on my own repos seemed to not break anything.