~lioploum/offpunk

339acef72045501b8203e501ffe5d76d6eba8668 — Étienne Mollier 9 months ago 9c8693d
opnk.py: fix warning with python3.12.

As initially identified by Paul Wise in [Debian Bug#1064209], opnk.py
experiences the following warning when running under python3.12:

	$ python3.12 opnk.py gemini://ploum.net >/dev/null
	/home/emollier/debian/forward-upstream/offpunk/opnk.py:52: SyntaxWarning: invalid escape sequence '\%'
	  less_prompt = "page %%d/%%D- lines %%lb/%%L - %%Pb\%%"

This is due to the interpretation of escape sequences being less
relaxed in the new Python interpreter version.  Doubling the backslash
is one way to resolve this issue.

[Debian Bug#1064209]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064209

Signed-off-by: Étienne Mollier <emollier@debian.org>
2 files changed, 2 insertions(+), 1 deletions(-)

M CHANGELOG
M opnk.py
M CHANGELOG => CHANGELOG +1 -0
@@ 3,6 3,7 @@
## 2.3 - Unreleased
- offpunk/netcache: fix IPv6 as an URL (bug #40)
- ansicat: display empty files (instead of opening them with xdg-open)
- fix escape sequence warning in python 3.12 (by Étienne Mollier) (Debian #1064209)

## 2.2 - February 13th 2023
- cache folder is now configurable through $OFFPUNK_CACHE_PATH environment variable (by prx)

M opnk.py => opnk.py +1 -1
@@ 49,7 49,7 @@ else:
# are there on purpose (surch in asciiart)
#--incsearch : incremental search starting rev581
def less_cmd(file, histfile=None,cat=False,grep=None):
    less_prompt = "page %%d/%%D- lines %%lb/%%L - %%Pb\%%"
    less_prompt = "page %%d/%%D- lines %%lb/%%L - %%Pb\\%%"
    if less_version >= 581:
        less_base = "less --incsearch --save-marks -~ -XRfWiS -P \"%s\""%less_prompt
    elif less_version >= 572: