You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
558 B

4 years ago
  1. import os
  2. import errno
  3. import sys
  4. from .extern import six
  5. def _makedirs_31(path, exist_ok=False):
  6. try:
  7. os.makedirs(path)
  8. except OSError as exc:
  9. if not exist_ok or exc.errno != errno.EEXIST:
  10. raise
  11. # rely on compatibility behavior until mode considerations
  12. # and exists_ok considerations are disentangled.
  13. # See https://github.com/pypa/setuptools/pull/1083#issuecomment-315168663
  14. needs_makedirs = (
  15. six.PY2 or
  16. (3, 4) <= sys.version_info < (3, 4, 1)
  17. )
  18. makedirs = _makedirs_31 if needs_makedirs else os.makedirs