py27compat.py 536 B

12345678910111213141516171819202122232425262728
  1. """
  2. Compatibility Support for Python 2.7 and earlier
  3. """
  4. import platform
  5. from setuptools.extern import six
  6. def get_all_headers(message, key):
  7. """
  8. Given an HTTPMessage, return all headers matching a given key.
  9. """
  10. return message.get_all(key)
  11. if six.PY2:
  12. def get_all_headers(message, key):
  13. return message.getheaders(key)
  14. linux_py2_ascii = (
  15. platform.system() == 'Linux' and
  16. six.PY2
  17. )
  18. rmtree_safe = str if linux_py2_ascii else lambda x: x
  19. """Workaround for http://bugs.python.org/issue24672"""