]> Savannah Git Hosting - gnulib.git/commitdiff
vfs: implement Project.mkdir method
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 22 Oct 2017 09:18:36 +0000 (12:18 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 22 Oct 2017 09:18:36 +0000 (12:18 +0300)
pygnulib.py
pygnulib/vfs.py

index 3cec4b10a6d8c222c9ce5cd51ffc44cc7d15bb77..ead918e0ba3126573dc7916394285521c7928845 100755 (executable)
@@ -165,10 +165,10 @@ def import_hook(script, gnulib, namespace, verbosity, options, *args, **kwargs):
     }
     table = {k:v for k,v in table.items() if v}
     table["top"] = ""
-    root = ProjectVFS(config.root, **table)
+    project = ProjectVFS(config.root, **table)
     local = BaseVFS(config.local, **table)
     for prefix in table:
-        os.makedirs(root[prefix], exist_ok=True)
+        project.mkdir(prefix)
 
 
     # First the files that are in old-files, but not in new-files:
index 61e92aa76dea62efc4efc8ab76fa4073a84d66d9..fd555ebe0f101cca5ad4add10339ba11b7e0fae3 100644 (file)
@@ -145,6 +145,11 @@ class Project(Base):
         return (tmp.name, True)
 
 
+    def mkdir(self, name):
+        """Create a leaf directory and all intermediate ones recursively."""
+        _os_.makedirs(self[name], exist_ok=True)
+
+
     def unlink(self, name, backup=True):
         """Unlink a file, backing it up if necessary."""
         if backup: