gs: make it work with empty dir

This commit is contained in:
Saugat Pachhai
2019-11-29 07:24:11 +05:45
parent 54dd9890dc
commit ee69ac835d
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -148,8 +148,16 @@ class RemoteGS(RemoteBASE):
def walk_files(self, path_info):
for fname in self._list_paths(path_info.bucket, path_info.path):
# skip nested empty directories
if fname.endswith("/"):
continue
yield path_info.replace(fname)
def makedirs(self, path_info):
self.gs.bucket(path_info.bucket).blob(
(path_info / "").path
).upload_from_string("")
def isdir(self, path_info):
dir_path = path_info / ""
return bool(
+1
View File
@@ -83,6 +83,7 @@ def remote_gs():
put_object("data/subdir/1", "1")
put_object("data/subdir/2", "2")
put_object("data/subdir/3", "3")
put_object("data/subdir/4/", "")
yield remote