equal
deleted
inserted
replaced
777 if safehasattr(self, '_fp'): # constructor actually did something |
777 if safehasattr(self, '_fp'): # constructor actually did something |
778 self.discard() |
778 self.discard() |
779 |
779 |
780 def makedirs(name, mode=None): |
780 def makedirs(name, mode=None): |
781 """recursive directory creation with parent mode inheritance""" |
781 """recursive directory creation with parent mode inheritance""" |
782 parent = os.path.abspath(os.path.dirname(name)) |
|
783 try: |
782 try: |
784 os.mkdir(name) |
783 os.mkdir(name) |
785 except OSError, err: |
784 except OSError, err: |
786 if err.errno == errno.EEXIST: |
785 if err.errno == errno.EEXIST: |
787 return |
786 return |
788 if not name or parent == name or err.errno != errno.ENOENT: |
787 if err.errno != errno.ENOENT or not name: |
|
788 raise |
|
789 parent = os.path.dirname(os.path.abspath(name)) |
|
790 if parent == name: |
789 raise |
791 raise |
790 makedirs(parent, mode) |
792 makedirs(parent, mode) |
791 os.mkdir(name) |
793 os.mkdir(name) |
792 if mode is not None: |
794 if mode is not None: |
793 os.chmod(name, mode) |
795 os.chmod(name, mode) |