From a7c6d64f76091d1cfd8297ba813fe4e901d00ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E4=B9=9D=E9=BC=8E?= <109224573@qq.com> Date: Wed, 26 Jan 2022 16:58:29 +0800 Subject: Use super() --- setuptools/package_index.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'setuptools/package_index.py') diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 270e7f3c..051e523a 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -285,7 +285,7 @@ class PackageIndex(Environment): self, index_url="https://pypi.org/simple/", hosts=('*',), ca_bundle=None, verify_ssl=True, *args, **kw ): - Environment.__init__(self, *args, **kw) + super().__init__(*args, **kw) self.index_url = index_url + "/" [:not index_url.endswith('/')] self.scanned_urls = {} self.fetched_urls = {} @@ -1002,7 +1002,7 @@ class PyPIConfig(configparser.RawConfigParser): Load from ~/.pypirc """ defaults = dict.fromkeys(['username', 'password', 'repository'], '') - configparser.RawConfigParser.__init__(self, defaults) + super().__init__(defaults) rc = os.path.join(os.path.expanduser('~'), '.pypirc') if os.path.exists(rc): -- cgit v1.2.1 From 66dcd5e54fd8fb1f9413b4fac04e073984ed0713 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 26 Feb 2022 12:29:32 -0500 Subject: Use samefile from stdlib, supported on Windows since Python 3.2. --- setuptools/package_index.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'setuptools/package_index.py') diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 051e523a..4b127f8c 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -680,8 +680,7 @@ class PackageIndex(Environment): # Make sure the file has been downloaded to the temp dir. if os.path.dirname(filename) != tmpdir: dst = os.path.join(tmpdir, basename) - from setuptools.command.easy_install import samefile - if not samefile(filename, dst): + if not os.path.samefile(filename, dst): shutil.copy2(filename, dst) filename = dst -- cgit v1.2.1 From fb7b30d64eb1475a0f5692e015ac123834ff6c40 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Sun, 27 Feb 2022 18:43:22 +0000 Subject: Check for file existence before using samefile --- setuptools/package_index.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/package_index.py') diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 4b127f8c..2c85ff2a 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -680,7 +680,8 @@ class PackageIndex(Environment): # Make sure the file has been downloaded to the temp dir. if os.path.dirname(filename) != tmpdir: dst = os.path.join(tmpdir, basename) - if not os.path.samefile(filename, dst): + both_exist = os.path.exists(filename) and os.path.exists(dst) + if not (both_exist and os.path.samefile(filename, dst)): shutil.copy2(filename, dst) filename = dst -- cgit v1.2.1 From 597ff8774e505803a565d9bebde2f8a48519b033 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Sun, 27 Feb 2022 18:57:50 +0000 Subject: Just check for if destination file exists --- setuptools/package_index.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'setuptools/package_index.py') diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 2c85ff2a..14881d29 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -680,8 +680,7 @@ class PackageIndex(Environment): # Make sure the file has been downloaded to the temp dir. if os.path.dirname(filename) != tmpdir: dst = os.path.join(tmpdir, basename) - both_exist = os.path.exists(filename) and os.path.exists(dst) - if not (both_exist and os.path.samefile(filename, dst)): + if not (os.path.exists(dst) and os.path.samefile(filename, dst)): shutil.copy2(filename, dst) filename = dst -- cgit v1.2.1