Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions dvc/tree/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,7 @@ def _gdrive_upload_file(
total=total,
disable=no_progress_bar,
) as wrapped:
# PyDrive doesn't like content property setting for empty files
# https://github.com/gsuitedevs/PyDrive/issues/121
if total:
item.content = wrapped
item.content = wrapped
item.Upload()
return item

Expand All @@ -381,23 +378,14 @@ def _gdrive_download_file(
# it does not create a file on the remote
gdrive_file = self._drive.CreateFile(param)

gdrive_file.FetchMetadata(fields="fileSize")
size = int(gdrive_file["fileSize"])

with Tqdm(
desc=progress_desc,
disable=no_progress_bar,
bytes=True,
# explicit `bar_format` as `total` will be set by `update_to`
bar_format=Tqdm.BAR_FMT_DEFAULT,
) as pbar:
if size:
gdrive_file.GetContentFile(to_file, callback=pbar.update_to)
else:
# PyDrive doesn't like downloading empty files
# https://github.com/iterative/dvc/issues/4286
with open(to_file, "w"):
pass
gdrive_file.GetContentFile(to_file, callback=pbar.update_to)

@contextmanager
@_gdrive_retry
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def run(self):
# Extra dependencies for remote integrations

gs = ["google-cloud-storage==1.19.0"]
gdrive = ["pydrive2>=1.6.1", "six >= 1.13.0"]
gdrive = ["pydrive2>=1.6.2", "six >= 1.13.0"]
s3 = ["boto3>=1.9.201"]
azure = ["azure-storage-blob>=12.0", "knack"]
oss = ["oss2==2.6.1"]
Expand Down