Opened 6 weeks ago

Closed 6 weeks ago

Last modified 5 weeks ago

#70527 closed defect (fixed)

itstool @2.0.7_2+python312: SyntaxWarning: invalid escape sequence

Reported by: christophecvr (christophecvr) Owned by: christophecvr (christophecvr)
Priority: Normal Milestone:
Component: ports Version: 2.10.99
Keywords: haspatch Cc:
Port: itstool

Description

Since the use off python ver 312 a lot of warning messages appear during build. A extract off those messages here: \

[319/322] /opt/local/bin/itstool -m help/uk/gedit-uk.gmo --lang uk -o help/uk ../gedit-3.38.2/help/C/gedit-change-color-scheme.page ../gedit-3.38.2/help/C/gedit-change-default-font.page ../gedit-3.38.2/help/C/gedit-close-file.page ../gedit-3.38.2/help/C/gedit-create-new-file.page ../gedit-3.38.2/help/C/gedit-edit-as-root.page ../gedit-3.38.2/help/C/gedit-files-basic.page ../gedit-3.38.2/help/C/gedit-full-screen.page ../gedit-3.38.2/help/C/gedit-open-files-from-sidepane.page ../gedit-3.38.2/help/C/gedit-open-files.page ../gedit-3.38.2/help/C/gedit-open-on-server.page ../gedit-3.38.2/help/C/gedit-open-recent.page ../gedit-3.38.2/help/C/gedit-plugin-guide.page ../gedit-3.38.2/help/C/gedit-plugins-change-case.page ../gedit-3.38.2/help/C/gedit-plugins-doc-stats.page ../gedit-3.38.2/help/C/gedit-plugins-external-tools.page ../gedit-3.38.2/help/C/gedit-plugins-file-browser.page ../gedit-3.38.2/help/C/gedit-plugins-insert-date-time.page ../gedit-3.38.2/help/C/gedit-plugins-install.page ../gedit-3.38.2/help/C/gedit-plugins-modelines.page ../gedit-3.38.2/help/C/gedit-plugins-pyconsole.page ../gedit-3.38.2/help/C/gedit-plugins-quick-open.page ../gedit-3.38.2/help/C/gedit-plugins-snippets.page ../gedit-3.38.2/help/C/gedit-plugins-sort.page ../gedit-3.38.2/help/C/gedit-printing-order.page ../gedit-3.38.2/help/C/gedit-printing.page ../gedit-3.38.2/help/C/gedit-printing-select.page ../gedit-3.38.2/help/C/gedit-quickstart.page ../gedit-3.38.2/help/C/gedit-replace.page ../gedit-3.38.2/help/C/gedit-save-file.page ../gedit-3.38.2/help/C/gedit-search.page ../gedit-3.38.2/help/C/gedit-spellcheck.page ../gedit-3.38.2/help/C/gedit-syntax-highlighting.page ../gedit-3.38.2/help/C/gedit-tab-groups.page ../gedit-3.38.2/help/C/gedit-tabs-moving.page ../gedit-3.38.2/help/C/gedit-tabs.page ../gedit-3.38.2/help/C/gedit-undo-redo.page ../gedit-3.38.2/help/C/index.page ../gedit-3.38.2/help/C/legal.xml
/opt/local/bin/itstool:223: SyntaxWarning: invalid escape sequence '\s'
  if re.sub('\s+', ' ', text).strip() != '':
/opt/local/bin/itstool:321: SyntaxWarning: invalid escape sequence '\s'
  message = re.sub('\s+', ' ', message).strip()
/opt/local/bin/itstool:459: SyntaxWarning: invalid escape sequence '\s'
  return re.sub('\s+', ' ', self.locnote).strip()
/opt/local/bin/itstool:461: SyntaxWarning: invalid escape sequence '\s'
  return '(itstool) link: ' + re.sub('\s+', ' ', self.locnoteref).strip()
/opt/local/bin/itstool:892: SyntaxWarning: invalid escape sequence '\<'
  regex = re.compile('(.*) \<(.*)\>, (.*)')
/opt/local/bin/itstool:927: SyntaxWarning: invalid escape sequence '\s'
  if re.sub('\s+', '', prevtext) == '':
/opt/local/bin/itstool:1471: SyntaxWarning: invalid escape sequence '\.'
  _locale_pattern = re.compile('([a-zA-Z0-9-]+)(_[A-Za-z0-9]+)?(@[A-Za-z0-9]+)?(\.[A-Za-z0-9]+)?')

I did find how to solve the issue and will post soon a pull request to macports-ports master with the solution for py312 its tool build.

Change History (6)

comment:1 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

comment:2 Changed 6 weeks ago by christophecvr (christophecvr)

ok all tests of patch have been done by me pull requests send to macports-ports master.

https://github.com/macports/macports-ports/pull/25276

The base test are all three succesfull.

Version 0, edited 6 weeks ago by christophecvr (christophecvr) (next)

comment:3 in reply to:  1 Changed 6 weeks ago by christophecvr (christophecvr)

Replying to ryandesign:

https://github.com/itstool/itstool/issues/54

https://github.com/itstool/itstool/pull/51

Well they did not merged those changes upstream and there is no update on the itstool. With the patch I send as pull request we wont be bothered anymore with this warning (which also causes wrong builds in gtk-docs). Guess, if they commit ths request and issue an updated itstool, sure this patch will not be needed anymore. But for now it is really needed when building with py312 support (patch only is applied for itstool python312 builds).

comment:4 Changed 6 weeks ago by christophecvr (christophecvr)

Owner: set to christophecvr
Resolution: fixed
Status: newclosed

In 2d9ef10c4a3d98f51d07acae604d5628e6a9c25f/macports-ports (master):

Itstool: fix invalid sequence for Python 3.12

Closes: #70527

comment:5 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)

I know that. I was showing you the fix that had been proposed to upstream so that you might consider using that fix in your MacPorts PR. Instead you fixed the problem a different way. I have not analyzed the two fixes to determine if they are equivalent.

Last edited 6 weeks ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 in reply to:  5 Changed 5 weeks ago by christophecvr (christophecvr)

Replying to ryandesign:

I know that. I was showing you the fix that had been proposed to upstream so that you might consider using that fix in your MacPorts PR. Instead you fixed the problem a different way. I have not analyzed the two fixes to determine if they are equivalent.

Sorry I missed this comment of you, just found it now. Basically there is not much difference . There are two ways of changing that escape sequence. One way is using and r in front of the string or add an backslash to the escape sequence:

r'\s' or '\\s'


for escaping a more complicated escape sequence like '\< ... >' it's best to use (in python)

r'\<...>'

Else it is much easier to use a double backslash

In the patch they used only the r option I used both. Since my change was tested very extensive I kept my solution.

Note: See TracTickets for help on using tickets.