Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DeprecationWarning / SyntaxWarning in regex #29

Merged
merged 2 commits into from
Aug 1, 2024
Merged

Fix DeprecationWarning / SyntaxWarning in regex #29

merged 2 commits into from
Aug 1, 2024

Conversation

Artalus
Copy link

@Artalus Artalus commented Jul 31, 2024

Starting with Python 3.12, Conan verbosely complains about deprecated syntax in patch_ng:

$ conan
/tmp/conan2/.venv/lib/python3.12/site-packages/patch_ng.py:427: SyntaxWarning: invalid escape sequence '\d'
  re_hunk_start = re.compile(b"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@")
/tmp/conan2/.venv/lib/python3.12/site-packages/patch_ng.py:578: SyntaxWarning: invalid escape sequence '\s'
  re_filename_date_time = b"^--- ([^\t]+)(?:\s([0-9-]+)\s([0-9:]+)|.*)"
/tmp/conan2/.venv/lib/python3.12/site-packages/patch_ng.py:621: SyntaxWarning: invalid escape sequence '\+'
  re_filename_date_time = b"^\+\+\+ ([^\t]+)(?:\s([0-9-]+)\s([0-9:]+)|.*)"
/tmp/conan2/.venv/lib/python3.12/site-packages/patch_ng.py:653: SyntaxWarning: invalid escape sequence '\d'
  match = re.match(b"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@(.*)", line)

Consumer commands
cache      Perform file operations in the local cache (of recipes and/or packages).
...

What was DeprecationWarning in older Pythons (see #22) is now a SyntaxWarning - which is probably why they now appear in Conan output.

This was fixed in upstream in the PR merged after this fork was created: techtonik#72

Closes #22

Closes #10

@uilianries
Copy link
Member

Hello @Artalus !! Thank you for pushing this hotfix! We gonna merge the PR #30 first, so we can run the CI again and validate your PR. At first sight it looks totally fine.

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It matches the upstream PR and using r is much safer for regex.

@uilianries uilianries merged commit 8d5ab0f into conan-io:master Aug 1, 2024
6 checks passed
@uilianries
Copy link
Member

@Artalus your PR is merged, thank you! We will be looking other issues along the week, before preparing a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeprecationWarning Deprecation warnings over invalid escape sequences in Python 3.7
2 participants