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 invalid escape sequences #922

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Fix invalid escape sequences #922

merged 1 commit into from
Jun 20, 2024

Conversation

meator
Copy link
Contributor

@meator meator commented Jun 19, 2024

Hello. I am a Void Linux package maintainer and I have noticed that terminator produces the following syntax warnings when issuing python3 -m compileall:

./usr/lib/python3.12/site-packages/terminatorlib/plugins/maven.py:35: SyntaxWarning: invalid escape sequence '\-'
  maven_filters['apache_maven_plugin_artifact_id'] = 'maven\-(%(apache_maven_plugin_shortname)s)\-plugin' % maven_filters
./usr/lib/python3.12/site-packages/terminatorlib/plugins/maven.py:36: SyntaxWarning: invalid escape sequence '\-'
  maven_filters['codehaus_maven_plugin_artifact_id'] = '(%(codehaus_maven_plugin_shortname)s)\-maven\-plugin' % maven_filters
./usr/lib/python3.12/site-packages/terminatorlib/plugins/maven.py:37: SyntaxWarning: invalid escape sequence '\.'
  maven_filters['maven_plugin_version'] = '[a-zA-Z0-9\.-]+'
./usr/lib/python3.12/site-packages/terminatorlib/plugins/mousefree_url_handler.py:54: SyntaxWarning: invalid escape sequence '\:'
  searchtext  = "https?\:\/\/[^\s]+[\/\w]"
./usr/lib/python3.12/site-packages/terminatorlib/plugins/url_handlers.py:16: SyntaxWarning: invalid escape sequence '\s'
  match = '\\b(lp|LP):?\s?#?[0-9]+(,\s*#?[0-9]+)*\\b'
./usr/lib/python3.12/site-packages/terminatorlib/plugins/url_handlers.py:39: SyntaxWarning: invalid escape sequence '\+'
  match = '\\b((lp|LP):%(project)s(/%(series)s)?|(lp|LP):%(group)s/(%(project)s|\+junk)/%(branch)s)\\b' % lpfilters

This pull request fixes them.

It looks like I'm not the only one who has noticed this problem:

resolves #920

@ScottMcCormack Does this pull request fix the issue for you? Your issue is related to version 2.1.3, so the warnings might be slightly different on master.

These escape sequences cause SyntaxWarnings in some environments.
@mattrose
Copy link
Member

Huh, I actually resolved a bunch of them in #886 but apparently I didn't catch them all. I'll pull this down and merge it in, thanks!

@mattrose
Copy link
Member

How did you get those warnings? I tried to reproduce this on master and I didn't get any SyntaxWarnings at all. did you just run python3 -m compileall in the terminator dir?

@mattrose
Copy link
Member

Gonna merge this in, but still curious as to how you were able to generate those syntax warnings.

@mattrose mattrose merged commit d163314 into gnome-terminator:master Jun 20, 2024
2 checks passed
@meator
Copy link
Contributor Author

meator commented Jun 20, 2024

I have discovered this issue because the XBPS package manager used by Void Linux has a trigger for byte compiling python packages.

There are likely better ways to reproduce this, but I used the following method to reproduce it manually:

cd terminator
python3 setup.py install --root="$PWD/dest"
cd dest
python3 -m compileall -f -q .

Older versions of Python do not print these warnings. I used Python 3.12.3.

@mminot-yseop
Copy link

Hi there @mattrose and everyone.

I ran just now into the related issue (#920) on the same OS as the issue creator (Ubuntu 24), with exactly the same logs, and there are a couple of things about this fix that I’d like to better understand. Please excuse me if my questions are stupid, but:

  • It seems that version 2.1.4 fixes this, but at the time of writing this, apt sticks to 2.1.3 for Ubuntu 24.04 (https://packages.ubuntu.com/noble/terminator). Are there any plans to provide 2.1.3 for 24.04?
  • I don’t understand how severe the consequences of those syntax issues are. Does it partly break Terminator’s setup? I get the No such file or directory: '/etc/xdg/terminator/config' error when launching Terminator after this installation (kinda like in Terminator v2.1.3 Errors on macOS Ventura #787, but just the parts about the XDG config) and I can’t figure out whether this is a related or unrelated issue, nor whether it is safe to use Terminator in this potentially-broken-setup state.

Thanks.

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.

SyntaxWarning raised during apt install
3 participants