theforeman / obal

packaging wrapper using ansible
GNU General Public License v2.0
9 stars 13 forks source link

try to import quote from shlex first, not pipes #349

Closed evgeni closed 1 year ago

evgeni commented 1 year ago

Python 3.3+ has it as shelex.quote while Python 2 has it as pipes.quote. As the pipes module is deprecated since Python 3.11, this raises a deprecation warning:

DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
  from pipes import quote

We can easily avoid that by first trying shlex.quote and falling back to pipes.quote only for Python 2 where shlex.quote doesn't exist.