Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pydrive2 for openSUSE:Factory checked in at 2022-06-06 12:38:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pydrive2 (Old) and /work/SRC/openSUSE:Factory/.python-pydrive2.new.1548 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pydrive2" Mon Jun 6 12:38:46 2022 rev:2 rq:980730 version:1.10.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pydrive2/python-pydrive2.changes 2021-07-08 22:49:43.463864655 +0200 +++ /work/SRC/openSUSE:Factory/.python-pydrive2.new.1548/python-pydrive2.changes 2022-06-06 12:38:48.107313380 +0200 @@ -1,0 +2,12 @@ +Fri Jun 3 11:11:45 UTC 2022 - Mark??ta Machov?? <mmach...@suse.com> + +- Update to 1.10.1 + * implement a fsspec-based filesystem backend + * fs.get_file: add callback support + * Add option to not launch the browser automatically via LocalWebserver + * make credentials save/load thread safe +- Add patches: + * modernize.patch: support up to Python 3.10 + * migrate-to-google-auth.patch: drop obsolete oauthlib2 requirement + +------------------------------------------------------------------- Old: ---- PyDrive2-1.8.3.tar.gz New: ---- PyDrive2-1.10.1.tar.gz migrate-to-google-auth.patch modernize.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pydrive2.spec ++++++ --- /var/tmp/diff_new_pack.THfUvi/_old 2022-06-06 12:38:48.855314755 +0200 +++ /var/tmp/diff_new_pack.THfUvi/_new 2022-06-06 12:38:48.859314763 +0200 @@ -1,7 +1,7 @@ # -# spec file for package python-PyDrive2 +# spec file for package python-pydrive2 # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,33 +18,46 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pydrive2 -Version: 1.8.3 +Version: 1.10.1 Release: 0 Summary: A wrapper library for google-api-python-client License: Apache-2.0 URL: https://github.com/iterative/PyDrive2 Source: https://files.pythonhosted.org/packages/source/P/PyDrive2/PyDrive2-%{version}.tar.gz -BuildRequires: python-rpm-macros +# PATCH-FIX-UPSTREAM https://github.com/iterative/PyDrive2/commit/2e43e4561d965ce78dc158a02fbdb75ba6c38105 pydrive2: modernise to python 3.7+ +Patch0: modernize.patch +# PATCH-FIX-UPSTREAM https://github.com/iterative/PyDrive2/pull/180 Migrating to Google Auth Library +Patch1: migrate-to-google-auth.patch BuildRequires: %{python_module setuptools} +BuildRequires: python-rpm-macros ## tests fail in OBS environment # SECTION test requirements #BuildRequires: %{python_module google-api-python-client >= 1.12.5} -#BuildRequires: %{python_module oauth2client >= 4.0.0} -#BuildRequires: %{python_module pyOpenSSL >= 19.1.0} #BuildRequires: %{python_module PyYAML >= 3.0} -#BuildRequires: %{python_module six >= 1.13.0} +#BuildRequires: %{python_module black} +BuildRequires: %{python_module filelock >= 3.7.0} +#BuildRequires: %{python_module flake8-docstrings} +#BuildRequires: %{python_module flake8} +#BuildRequires: %{python_module fsspec} +#BuildRequires: %{python_module funcy >= 1.14} +BuildRequires: %{python_module google-auth-oauthlib >= 0.5.1} +BuildRequires: %{python_module google-auth >= 2.6.6} +BuildRequires: %{python_module google-auth-httplib2 >= 0.1.0} +#BuildRequires: %{python_module pyOpenSSL >= 19.1.0} +#BuildRequires: %{python_module pytest-mock} #BuildRequires: %{python_module pytest} +#BuildRequires: %{python_module six >= 1.13.0} #BuildRequires: %{python_module timeout-decorator} -#BuildRequires: %{python_module funcy >= 1.14} -#BuildRequires: %{python_module flake8} -#BuildRequires: %{python_module flake8-docstrings} -#BuildRequires: %{python_module black} +#BuildRequires: %{python_module tqdm} # /SECTION BuildRequires: fdupes +Requires: python-PyYAML >= 3.0 +Requires: python-filelock >= 3.7.0 Requires: python-google-api-python-client >= 1.12.5 -Requires: python-oauth2client >= 4.0.0 +Requires: python-google-auth >= 2.6.6 +Requires: python-google-auth-httplib2 >= 0.1.0 +Requires: python-google-auth-oauthlib >= 0.5.1 Requires: python-pyOpenSSL >= 19.1.0 -Requires: python-PyYAML >= 3.0 Requires: python-six >= 1.13.0 BuildArch: noarch %python_subpackages @@ -56,6 +69,7 @@ %prep %setup -q -n PyDrive2-%{version} +%autopatch -p1 %build %python_build ++++++ PyDrive2-1.8.3.tar.gz -> PyDrive2-1.10.1.tar.gz ++++++ /work/SRC/openSUSE:Factory/python-pydrive2/PyDrive2-1.8.3.tar.gz /work/SRC/openSUSE:Factory/.python-pydrive2.new.1548/PyDrive2-1.10.1.tar.gz differ: char 5, line 1 ++++++ migrate-to-google-auth.patch ++++++ ++++ 1794 lines (skipped) ++++++ modernize.patch ++++++ >From 2e43e4561d965ce78dc158a02fbdb75ba6c38105 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev <kupru...@gmail.com> Date: Wed, 27 Apr 2022 15:31:53 +0300 Subject: [PATCH] pydrive2: pyupgrade --py37-plus --- pydrive2/apiattr.py | 15 ++++++--------- pydrive2/auth.py | 14 ++++++-------- pydrive2/drive.py | 2 +- pydrive2/files.py | 10 ++++------ pydrive2/settings.py | 8 +++----- pydrive2/test/test_drive.py | 1 - pydrive2/test/test_file.py | 18 ++++++++---------- pydrive2/test/test_filelist.py | 7 +++---- setup.py | 4 +--- 9 files changed, 32 insertions(+), 47 deletions(-) diff --git a/pydrive2/apiattr.py b/pydrive2/apiattr.py index 46845b1..6b66b42 100644 --- a/pydrive2/apiattr.py +++ b/pydrive2/apiattr.py @@ -1,7 +1,4 @@ -from six import Iterator, iteritems - - -class ApiAttribute(object): +class ApiAttribute: """A data descriptor that sets and returns values.""" def __init__(self, name): @@ -32,7 +29,7 @@ def __del__(self, obj=None): del obj.dirty[self.name] -class ApiAttributeMixin(object): +class ApiAttributeMixin: """Mixin to initialize required global variables to use ApiAttribute.""" def __init__(self): @@ -54,7 +51,7 @@ class ApiResource(dict): def __init__(self, *args, **kwargs): """Create an instance of ApiResource.""" - super(ApiResource, self).__init__() + super().__init__() self.update(*args, **kwargs) self.metadata = dict(self) @@ -79,11 +76,11 @@ def __setitem__(self, key, val): def __repr__(self): """Overwritten method of dictionary.""" dict_representation = dict.__repr__(self) - return "%s(%s)" % (type(self).__name__, dict_representation) + return f"{type(self).__name__}({dict_representation})" def update(self, *args, **kwargs): """Overwritten method of dictionary.""" - for k, v in iteritems(dict(*args, **kwargs)): + for k, v in dict(*args, **kwargs).items(): self[k] = v def UpdateMetadata(self, metadata=None): @@ -106,7 +103,7 @@ def GetChanges(self): return dirty -class ApiResourceList(ApiAttributeMixin, ApiResource, Iterator): +class ApiResourceList(ApiAttributeMixin, ApiResource): """Abstract class of all api list resources. Inherits ApiResource and builds iterator to list any API resource. diff --git a/pydrive2/auth.py b/pydrive2/auth.py index 644befb..a1b8b2f 100644 --- a/pydrive2/auth.py +++ b/pydrive2/auth.py @@ -1,8 +1,6 @@ -import socket import webbrowser import httplib2 import oauth2client.clientsecrets as clientsecrets -from six.moves import input import threading from googleapiclient.discovery import build @@ -141,7 +139,7 @@ def _decorated(self, *args, **kwargs): return _decorated -class GoogleAuth(ApiAttributeMixin, object): +class GoogleAuth(ApiAttributeMixin): """Wrapper class for oauth2client library in google-api-python-client. Loads all settings and credentials from one 'settings.yaml' file @@ -241,13 +239,13 @@ def LocalWebserverAuth( httpd = ClientRedirectServer( (host_name, port), ClientRedirectHandler ) - except socket.error: + except OSError: pass else: success = True break if success: - oauth_callback = "http://%s:%s/" % (host_name, port_number) + oauth_callback = f"http://{host_name}:{port_number}/" else: print( "Failed to start a local web server. Please check your firewall" @@ -381,7 +379,7 @@ def LoadCredentialsFile(self, credentials_file=None): try: self.credentials = self._default_storage.get() - except IOError: + except OSError: raise InvalidCredentialsError( "Credentials file cannot be symbolic link" ) @@ -431,7 +429,7 @@ def SaveCredentialsFile(self, credentials_file=None): try: storage.put(self.credentials) - except IOError: + except OSError: raise InvalidCredentialsError( "Credentials file cannot be symbolic link" ) @@ -538,7 +536,7 @@ def LoadServiceConfigSettings(self): ] except KeyError: err = "Insufficient service config in settings" - err += "\n\nMissing: {} key.".format(config) + err += f"\n\nMissing: {config} key." raise InvalidConfigError(err) def LoadClientConfigSettings(self): diff --git a/pydrive2/drive.py b/pydrive2/drive.py index d8b26aa..8189ab1 100644 --- a/pydrive2/drive.py +++ b/pydrive2/drive.py @@ -4,7 +4,7 @@ from .auth import LoadAuth -class GoogleDrive(ApiAttributeMixin, object): +class GoogleDrive(ApiAttributeMixin): """Main Google Drive class.""" def __init__(self, auth=None): diff --git a/pydrive2/files.py b/pydrive2/files.py index 096f9bb..4716c7d 100644 --- a/pydrive2/files.py +++ b/pydrive2/files.py @@ -17,9 +17,7 @@ BLOCK_SIZE = 1024 # Usage: MIME_TYPE_TO_BOM['<Google Drive mime type>']['<download mimetype>']. MIME_TYPE_TO_BOM = { - "application/vnd.google-apps.document": { - "text/plain": "\ufeff".encode("utf8") - } + "application/vnd.google-apps.document": {"text/plain": "\ufeff".encode()} } @@ -68,7 +66,7 @@ class GoogleDriveFileList(ApiResourceList): def __init__(self, auth=None, param=None): """Create an instance of GoogleDriveFileList.""" - super(GoogleDriveFileList, self).__init__(auth=auth, metadata=param) + super().__init__(auth=auth, metadata=param) @LoadAuth def _GetList(self): @@ -98,7 +96,7 @@ def _GetList(self): return result -class IoBuffer(object): +class IoBuffer: """Lightweight retention of one chunk.""" def __init__(self, encoding): @@ -116,7 +114,7 @@ def read(self): ) -class MediaIoReadable(object): +class MediaIoReadable: def __init__( self, request, diff --git a/pydrive2/settings.py b/pydrive2/settings.py index 8e79881..f5e84ab 100644 --- a/pydrive2/settings.py +++ b/pydrive2/settings.py @@ -103,9 +103,9 @@ def LoadSettingsFile(filename=SETTINGS_FILE): :raises: SettingsError """ try: - with open(filename, "r") as stream: + with open(filename) as stream: data = load(stream, Loader=Loader) - except (YAMLError, IOError) as e: + except (YAMLError, OSError) as e: raise SettingsError(e) return data @@ -158,9 +158,7 @@ def _ValidateSettingsElement(data, struct, key): data[key] = default # If data exists, Check type of the data elif type(value) is not data_type: - raise InvalidConfigError( - "Setting %s should be type %s" % (key, data_type) - ) + raise InvalidConfigError(f"Setting {key} should be type {data_type}") # If type of this data is dict, check if structure of the data is valid. if data_type is dict: _ValidateSettingsStruct(data[key], struct[key]["struct"]) diff --git a/pydrive2/test/test_drive.py b/pydrive2/test/test_drive.py index 23b58a6..81498a8 100644 --- a/pydrive2/test/test_drive.py +++ b/pydrive2/test/test_drive.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import unittest from pydrive2.auth import GoogleAuth diff --git a/pydrive2/test/test_file.py b/pydrive2/test/test_file.py index e83898c..bf3021a 100644 --- a/pydrive2/test/test_file.py +++ b/pydrive2/test/test_file.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import filecmp import os import unittest @@ -8,7 +7,6 @@ from tempfile import mkdtemp from time import time -from six.moves import range import timeout_decorator from concurrent.futures import ThreadPoolExecutor, as_completed from googleapiclient import errors @@ -699,22 +697,22 @@ def test_Gfile_Conversion_Add_Remove_BOM(self): def test_InsertPrefix(self): # Create BytesIO. - file_obj = BytesIO("abc".encode("utf8")) + file_obj = BytesIO(b"abc") original_length = len(file_obj.getvalue()) - char_to_insert = "\ufeff".encode("utf8") + char_to_insert = "\ufeff".encode() # Insert the prefix. GoogleDriveFile._InsertPrefix(file_obj, char_to_insert) modified_length = len(file_obj.getvalue()) self.assertGreater(modified_length, original_length) - self.assertEqual(file_obj.getvalue(), "\ufeffabc".encode("utf8")) + self.assertEqual(file_obj.getvalue(), "\ufeffabc".encode()) def test_InsertPrefixLarge(self): # Create BytesIO. test_content = "abc" * 800 file_obj = BytesIO(test_content.encode("utf-8")) original_length = len(file_obj.getvalue()) - char_to_insert = "\ufeff".encode("utf8") + char_to_insert = "\ufeff".encode() # Insert the prefix. GoogleDriveFile._InsertPrefix(file_obj, char_to_insert) @@ -725,22 +723,22 @@ def test_InsertPrefixLarge(self): def test_RemovePrefix(self): # Create BytesIO. - file_obj = BytesIO("\ufeffabc".encode("utf8")) + file_obj = BytesIO("\ufeffabc".encode()) original_length = len(file_obj.getvalue()) - char_to_remove = "\ufeff".encode("utf8") + char_to_remove = "\ufeff".encode() # Insert the prefix. GoogleDriveFile._RemovePrefix(file_obj, char_to_remove) modified_length = len(file_obj.getvalue()) self.assertLess(modified_length, original_length) - self.assertEqual(file_obj.getvalue(), "abc".encode("utf8")) + self.assertEqual(file_obj.getvalue(), b"abc") def test_RemovePrefixLarge(self): # Create BytesIO. test_content = "\ufeff" + "abc" * 800 file_obj = BytesIO(test_content.encode("utf8")) original_length = len(file_obj.getvalue()) - char_to_remove = "\ufeff".encode("utf8") + char_to_remove = "\ufeff".encode() # Insert the prefix. GoogleDriveFile._RemovePrefix(file_obj, char_to_remove) diff --git a/pydrive2/test/test_filelist.py b/pydrive2/test/test_filelist.py index 644c13f..15918cd 100644 --- a/pydrive2/test/test_filelist.py +++ b/pydrive2/test/test_filelist.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os import unittest @@ -28,7 +27,7 @@ def setup_class(cls): def test_01_Files_List_GetList(self): drive = GoogleDrive(self.ga) - query = "title = '{}' and trashed = false".format(self.title) + query = f"title = '{self.title}' and trashed = false" for file1 in pydrive_list_item(drive, query): found = False for file2 in pydrive_list_item(drive, query): @@ -38,7 +37,7 @@ def test_01_Files_List_GetList(self): def test_02_Files_List_ForLoop(self): drive = GoogleDrive(self.ga) - query = "title = '{}' and trashed = false".format(self.title) + query = f"title = '{self.title}' and trashed = false" files = [] for x in pydrive_list_item( drive, query, 2 @@ -84,7 +83,7 @@ def test_File_List_Folders(self): ) pydrive_retry(folder1.Upload) self.file_list.append(folder1) - query = "title = '{}' and trashed = false".format(self.title) + query = f"title = '{self.title}' and trashed = false" count = 0 for file1 in pydrive_list_item(drive, query): self.assertFileInFileList(file1) diff --git a/setup.py b/setup.py index 32c9364..06982d0 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -import sys from setuptools import setup # Extra dependecies to run tests @@ -11,8 +10,7 @@ "pytest-mock", ] -if sys.version_info >= (3, 6): - tests_requirements.append("black==22.3.0") +tests_requirements.append("black==22.3.0") setup( name="PyDrive2",