From 3e75fe99e38f046f4f91c76e3c4c51e799d44c86 Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Tue, 9 Mar 2021 18:44:48 +0300 Subject: [PATCH] gdrive: change the temporary directory location to .dvc/tmp (#5583) --- dvc/fs/gdrive.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dvc/fs/gdrive.py b/dvc/fs/gdrive.py index 2d2c92b54..c66b79645 100644 --- a/dvc/fs/gdrive.py +++ b/dvc/fs/gdrive.py @@ -3,7 +3,6 @@ import logging import os import posixpath import re -import tempfile import threading from collections import defaultdict from contextlib import contextmanager @@ -127,6 +126,9 @@ class GDriveFileSystem(BaseFileSystem): self._client_id = config.get("gdrive_client_id") self._client_secret = config.get("gdrive_client_secret") self._validate_config() + self._gdrive_service_credentials_path = tmp_fname( + os.path.join(self.repo.tmp_dir, "") + ) self._gdrive_user_credentials_path = ( tmp_fname(os.path.join(self.repo.tmp_dir, "")) if os.getenv(GDriveFileSystem.GDRIVE_CREDENTIALS_DATA) @@ -214,9 +216,7 @@ class GDriveFileSystem(BaseFileSystem): GDriveFileSystem.GDRIVE_CREDENTIALS_DATA ) if self._use_service_account: - temporary_save_path = os.path.join( - tempfile.gettempdir(), "google-creds.json" - ) + temporary_save_path = self._gdrive_service_credentials_path if is_credentials_temp: with open(temporary_save_path, "w") as cred_file: