From 000d698bad3df40a4d003dd0979ddd5d01b66d5d Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sun, 22 Oct 2017 12:18:36 +0300 Subject: [PATCH] vfs: implement Project.mkdir method --- pygnulib.py | 4 ++-- pygnulib/vfs.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pygnulib.py b/pygnulib.py index 3cec4b10a6..ead918e0ba 100755 --- a/pygnulib.py +++ b/pygnulib.py @@ -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: diff --git a/pygnulib/vfs.py b/pygnulib/vfs.py index 61e92aa76d..fd555ebe0f 100644 --- a/pygnulib/vfs.py +++ b/pygnulib/vfs.py @@ -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: -- 2.39.5