Bug 1942259 - Replace pipes imports a=dmeehan

pipes does not exist in Python 3.11 any more

Original Revision: https://phabricator.services.mozilla.com/D227964

Differential Revision: https://phabricator.services.mozilla.com/D236165
This commit is contained in:
Rob Wu 2025-02-07 18:08:44 +00:00
parent a03dc5f488
commit b6a806fdf1
4 changed files with 5 additions and 10 deletions

View file

@ -1,6 +1,6 @@
import json import json
import pipes
import re import re
import shlex
from .progressbar import NullProgressBar, ProgressBar from .progressbar import NullProgressBar, ProgressBar
from .structuredlog import TestLogger from .structuredlog import TestLogger
@ -9,7 +9,7 @@ from .structuredlog import TestLogger
def escape_cmdline(args): def escape_cmdline(args):
return " ".join([pipes.quote(a) for a in args]) return " ".join([shlex.quote(a) for a in args])
class TestOutput: class TestOutput:

View file

@ -4,7 +4,6 @@
import io import io
import os import os
import pipes
import posixpath import posixpath
import re import re
import shlex import shlex
@ -1292,8 +1291,6 @@ class ADBDevice(ADBCommand):
"""Utility function to return quoted version of command argument.""" """Utility function to return quoted version of command argument."""
if hasattr(shlex, "quote"): if hasattr(shlex, "quote"):
quote = shlex.quote quote = shlex.quote
elif hasattr(pipes, "quote"):
quote = pipes.quote
else: else:
def quote(arg): def quote(arg):

View file

@ -20,8 +20,6 @@ filterwarnings =
ignore:This method will be removed in .*\.\s+Use 'parser\.read_file\(\)' instead\.:DeprecationWarning:mozversion ignore:This method will be removed in .*\.\s+Use 'parser\.read_file\(\)' instead\.:DeprecationWarning:mozversion
# ignore mozversion not cleanly closing .ini files # ignore mozversion not cleanly closing .ini files
ignore:unclosed file.*\.ini:ResourceWarning:mozversion ignore:unclosed file.*\.ini:ResourceWarning:mozversion
# mozdevice uses pipes module
ignore:'pipes' is deprecated and slated for removal in Python 3:DeprecationWarning
# mozrunner uses telnetlib module # mozrunner uses telnetlib module
ignore:'telnetlib' is deprecated and slated for removal in Python 3:DeprecationWarning ignore:'telnetlib' is deprecated and slated for removal in Python 3:DeprecationWarning
# https://github.com/web-platform-tests/wpt/issues/39366 # https://github.com/web-platform-tests/wpt/issues/39366

View file

@ -7,10 +7,10 @@
import copy import copy
import json import json
import os import os
import pipes
import platform import platform
import random import random
import re import re
import shlex
import shutil import shutil
import signal import signal
import subprocess import subprocess
@ -372,11 +372,11 @@ class XPCShellTestThread(Thread):
) )
self.log.info("%s | environment: %s" % (name, list(changedEnv))) self.log.info("%s | environment: %s" % (name, list(changedEnv)))
shell_command_tokens = [ shell_command_tokens = [
pipes.quote(tok) for tok in list(changedEnv) + completeCmd shlex.quote(tok) for tok in list(changedEnv) + completeCmd
] ]
self.log.info( self.log.info(
"%s | as shell command: (cd %s; %s)" "%s | as shell command: (cd %s; %s)"
% (name, pipes.quote(testdir), " ".join(shell_command_tokens)) % (name, shlex.quote(testdir), " ".join(shell_command_tokens))
) )
def killTimeout(self, proc): def killTimeout(self, proc):