Skip to contentSkip to conversation

buildman: Create parent directories as necessary

PATCH Superseded Thierry Reding 2 participants 2 messages Aug 18, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildman: Create parent directories as necessary

From: Thierry Reding <[email protected]>

When creating build directories also create parents as necessary. This fixes a failure when building a hierarchical branch (i.e. foo/bar).

---
 tools/buildman/builderthread.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/buildman/builderthread.py +1 -1
index 32297e20e8f0..ca309c46d963 100644
@@ -19,7 +19,7 @@ def Mkdir(dirname):
         dirname: Directory to create
     """
     try:
-        os.mkdir(dirname)
+        os.makedirs(dirname)
     except OSError as err:
         if err.errno == errno.EEXIST:
             pass
Signature · 1 line
2.0.4
#1 lore raw

PATCH 1/1 buildman: Create parent directories as necessary

Hi Thierry,

Quoted 16 lines · Thierry Reding

From: Thierry Reding <[email protected]>

When creating build directories also create parents as necessary. This fixes a failure when building a hierarchical branch (i.e. foo/bar).

---
 tools/buildman/builderthread.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/buildman/builderthread.py +0 -0
index 32297e20e8f0..ca309c46d963 100644

tools/buildman/builderthread.py def Mkdir(dirname): · line 25

Quoted 8 lines
tools/buildman/builderthread.py +1 -1
@@ -19,7 +19,7 @@ def Mkdir(dirname):
         dirname: Directory to create
     """
     try:
-        os.mkdir(dirname)
+        os.makedirs(dirname)
     except OSError as err:
         if err.errno == errno.EEXIST:
             pass

Thanks for the patch, this problem does need fixing.

But this solution seems quite heavy-handed, as the problem only exits with the top-level directory. Instead, perhaps we could use os.makedirs() in Builder.__init__(). This would avoid sloppy directory creation later.

Regards,
Simon