File exaile-support-python-313.patch of Package exaile
From f37bb5e3ef33f05c12fd30fcbf38207498d7a909 Mon Sep 17 00:00:00 2001
From: Johannes Sasongko <johannes@sasongko.org>
Date: Tue, 30 Jul 2024 19:21:06 +1000
Subject: [PATCH] generate-completion: Replace pipes.quote with shlex.quote
They are the same thing, and pipes is going away in Python 3.13.
Fixes: https://github.com/exaile/exaile/issues/935
---
tools/generate-completion.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/generate-completion.py b/tools/generate-completion.py
index 92e558db1..4230c94cc 100755
--- a/tools/generate-completion.py
+++ b/tools/generate-completion.py
@@ -93,7 +93,7 @@ def fish_completion(parser):
:type parser: argparse.ArgumentParser
"""
- import pipes
+ import shlex
options = []
for action in parser._actions:
@@ -104,11 +104,11 @@ def fish_completion(parser):
for name in names:
assert len(name) >= 2 and name[0] == '-' and name != '--'
if len(name) == 2:
- option.append('-s ' + pipes.quote(name[1]))
+ option.append('-s ' + shlex.quote(name[1]))
elif name[1] == '-':
- option.append('-l ' + pipes.quote(name[2:]))
+ option.append('-l ' + shlex.quote(name[2:]))
else:
- option.append('-o ' + pipes.quote(name[1:]))
+ option.append('-o ' + shlex.quote(name[1:]))
if action.metavar in ('LOCATION', 'DIRECTORY'):
option.append('-r')
elif action.metavar is not None:
@@ -116,10 +116,10 @@ def fish_completion(parser):
if action.choices:
choices = action.choices
if isinstance(choices, (list, tuple)):
- choices = (pipes.quote(str(c))+'\\t' for c in choices)
- option.append('-a ' + pipes.quote(' '.join(choices)))
+ choices = (shlex.quote(str(c))+'\\t' for c in choices)
+ option.append('-a ' + shlex.quote(' '.join(choices)))
if action.help:
- option.append('-d ' + pipes.quote(action.help % action.__dict__))
+ option.append('-d ' + shlex.quote(action.help % action.__dict__))
options.append(' '.join(option))
return '\n'.join(options)