Skip to content

Remove pipes module on versions > 3.3. #22

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ jobs:
- python: pypy
include:
- python: pypy
- python: 3.12
- python: 3.11
- python: 3.10
- python: 3.9
- python: 3.8
- python: 3.7
- python: 3.6
Expand Down
13 changes: 10 additions & 3 deletions executor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,20 @@
import errno
import logging
import os
import pipes
import pprint
import shlex
import signal
import subprocess
import sys
import tempfile

# The pipes module was deprecated in 3.11 (to be removed in 3.13).
# shlex.quote was introduced in 3.3 and pipes adopted it immediately.
if sys.version_info < (3, 3):
from pipes import quote as py_quote
else:
from shlex import quote as py_quote

# External dependencies.
from humanfriendly.text import compact, concatenate, format, pluralize
from humanfriendly.terminal import connected_to_terminal
Expand Down Expand Up @@ -1986,7 +1992,8 @@ def quote(*args):
"""
Quote a string or a sequence of strings to be used as command line argument(s).

This function is a simple wrapper around :func:`pipes.quote()` which
This function is a simple wrapper around :func:`shlex.quote()`
or :func:`pipes.quote()` (if the Python version is less than 3.3) which
adds support for quoting sequences of strings (lists and tuples). For
example the following calls are all equivalent::

Expand All @@ -2006,7 +2013,7 @@ def quote(*args):
else:
value = args[0]
if not isinstance(value, (list, tuple)):
return pipes.quote(value)
return py_quote(value)
return ' '.join(map(quote, value))


Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def get_absolute_path(*args):
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet',
Expand Down