All pastes #618226 Raw Edit

AstralStorm: pkgcore patch

public text v1 · immutable
·published 2007-07-13 20:39 UTC
rendered paste body
=== modified file 'pkgcore/fs/ops.py'
--- pkgcore/fs/ops.py   2007-06-17 03:49:16 +0000
+++ pkgcore/fs/ops.py   2007-07-13 20:36:05 +0000
@@ -226,6 +226,7 @@
         iterate = iter
 
     d = list(iterate(cset.iterdirs()))
+    # Create parent dirs first
     d.sort()
     for x in d:
         callback(x)
@@ -243,14 +244,10 @@
         except OSError, oe:
             if oe.errno != errno.ENOENT:
                 raise
-            try:
-                # we do this form to catch dangling symlinks
-                mkdir(x)
-            except OSError, oe:
-                if oe.errno != errno.EEXIST:
-                    raise
+            # Remove the dangling symbolic link
+            if os.path.islink(x.location):
                 os.unlink(x.location)
-                mkdir(x)
+            mkdir(x)
             ensure_perms(x)
     del d