From: Dmitry Selyutin <ghostmansd@gmail.com> Date: Sun, 22 Oct 2017 09:18:36 +0000 (+0300) Subject: vfs: implement Project.mkdir method X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=000d698bad3df40a4d003dd0979ddd5d01b66d5d;p=gnulib.git vfs: implement Project.mkdir method --- 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: