From 047d828fcf15954cb6f62b8a476e58f0b0c9f07d Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 2 Oct 2022 09:46:31 -0400 Subject: [PATCH 1/2] Prep to vendor in latest wheel version. --- pipenv/vendor/vendor.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/vendor/vendor.txt b/pipenv/vendor/vendor.txt index 0238665b..b8def370 100644 --- a/pipenv/vendor/vendor.txt +++ b/pipenv/vendor/vendor.txt @@ -24,5 +24,5 @@ toml==0.10.2 tomli==1.1.0 tomlkit==0.9.2 vistir==0.6.1 -wheel==0.36.2 +wheel==0.37.1 yaspin==2.0.0 From c0dcc4ad83b3a9a5a88b1fb58a237de37fe95929 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 2 Oct 2022 09:55:47 -0400 Subject: [PATCH 2/2] Vendor in latest wheel version and add missing license file. --- .../patched/pip/_vendor/pkg_resources/LICENSE | 19 +++++++++ pipenv/vendor/wheel/__init__.py | 2 +- pipenv/vendor/wheel/cli/pack.py | 5 ++- pipenv/vendor/wheel/macosx_libfile.py | 4 +- .../vendor/wheel/vendored/packaging/tags.py | 24 ++++++++--- pipenv/vendor/wheel/wheelfile.py | 42 ++++++++++++------- 6 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 pipenv/patched/pip/_vendor/pkg_resources/LICENSE diff --git a/pipenv/patched/pip/_vendor/pkg_resources/LICENSE b/pipenv/patched/pip/_vendor/pkg_resources/LICENSE new file mode 100644 index 00000000..6e0693b4 --- /dev/null +++ b/pipenv/patched/pip/_vendor/pkg_resources/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2016 Jason R Coombs + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/pipenv/vendor/wheel/__init__.py b/pipenv/vendor/wheel/__init__.py index 349a8f7b..a4b38359 100644 --- a/pipenv/vendor/wheel/__init__.py +++ b/pipenv/vendor/wheel/__init__.py @@ -1 +1 @@ -__version__ = '0.36.2' +__version__ = '0.37.1' diff --git a/pipenv/vendor/wheel/cli/pack.py b/pipenv/vendor/wheel/cli/pack.py index 762da308..6a8331c9 100644 --- a/pipenv/vendor/wheel/cli/pack.py +++ b/pipenv/vendor/wheel/cli/pack.py @@ -57,9 +57,12 @@ def pack(directory, dest_dir, build_number): replacement = ('Build: %s\r\n' % build_number).encode('ascii') if build_number else b'' with open(wheel_file_path, 'rb+') as f: wheel_file_content = f.read() - if not BUILD_NUM_RE.subn(replacement, wheel_file_content)[1]: + wheel_file_content, num_replaced = BUILD_NUM_RE.subn(replacement, + wheel_file_content) + if not num_replaced: wheel_file_content += replacement + f.seek(0) f.truncate() f.write(wheel_file_content) diff --git a/pipenv/vendor/wheel/macosx_libfile.py b/pipenv/vendor/wheel/macosx_libfile.py index 8918039f..39006fb0 100644 --- a/pipenv/vendor/wheel/macosx_libfile.py +++ b/pipenv/vendor/wheel/macosx_libfile.py @@ -28,7 +28,7 @@ because them contains information about minimal system version. Important remarks: - For fat files this implementation looks for maximum number version. - It not check if it is 32 or 64 and do not compare it with currently builded package. + It not check if it is 32 or 64 and do not compare it with currently built package. So it is possible to false report higher version that needed. - All structures signatures are taken form macosx header files. - I think that binary format will be more stable than `otool` output. @@ -279,7 +279,7 @@ def extract_macosx_min_system_version(path_to_lib): # Xcode will not set the deployment target below 11.0.0 # for the arm64 architecture. Ignore the arm64 deployment # in fat binaries when the target is 11.0.0, that way - # the other architetures can select a lower deployment + # the other architectures can select a lower deployment # target. # This is safe because there is no arm64 variant for # macOS 10.15 or earlier. diff --git a/pipenv/vendor/wheel/vendored/packaging/tags.py b/pipenv/vendor/wheel/vendored/packaging/tags.py index 3306c690..c2a140c2 100644 --- a/pipenv/vendor/wheel/vendored/packaging/tags.py +++ b/pipenv/vendor/wheel/vendored/packaging/tags.py @@ -458,14 +458,28 @@ def mac_platforms(version=None, arch=None): major=major_version, minor=0, binary_format=binary_format ) - if version >= (11, 0) and arch == "x86_64": + if version >= (11, 0): # Mac OS 11 on x86_64 is compatible with binaries from previous releases. # Arm64 support was introduced in 11.0, so no Arm binaries from previous # releases exist. - for minor_version in range(16, 3, -1): - compat_version = 10, minor_version - binary_formats = _mac_binary_formats(compat_version, arch) - for binary_format in binary_formats: + # + # However, the "universal2" binary format can have a + # macOS version earlier than 11.0 when the x86_64 part of the binary supports + # that version of macOS. + if arch == "x86_64": + for minor_version in range(16, 3, -1): + compat_version = 10, minor_version + binary_formats = _mac_binary_formats(compat_version, arch) + for binary_format in binary_formats: + yield "macosx_{major}_{minor}_{binary_format}".format( + major=compat_version[0], + minor=compat_version[1], + binary_format=binary_format, + ) + else: + for minor_version in range(16, 3, -1): + compat_version = 10, minor_version + binary_format = "universal2" yield "macosx_{major}_{minor}_{binary_format}".format( major=compat_version[0], minor=compat_version[1], diff --git a/pipenv/vendor/wheel/wheelfile.py b/pipenv/vendor/wheel/wheelfile.py index d29c0823..a17cff43 100644 --- a/pipenv/vendor/wheel/wheelfile.py +++ b/pipenv/vendor/wheel/wheelfile.py @@ -5,6 +5,7 @@ import hashlib import os.path import re import stat +import sys import time from collections import OrderedDict from distutils import log as logger @@ -13,6 +14,16 @@ from zipfile import ZIP_DEFLATED, ZipInfo, ZipFile from pipenv.vendor.wheel.cli import WheelError from pipenv.vendor.wheel.util import urlsafe_b64decode, as_unicode, native, urlsafe_b64encode, as_bytes, StringIO +if sys.version_info >= (3,): + from io import TextIOWrapper + + def read_csv(fp): + return csv.reader(TextIOWrapper(fp, newline='', encoding='utf-8')) +else: + def read_csv(fp): + for line in csv.reader(fp): + yield [column.decode('utf-8') for column in line] + # Non-greedy matching of an optional build number may be too clever (more # invalid wheel filenames will match). Separate regex for .dist-info? WHEEL_INFO_RE = re.compile( @@ -60,23 +71,24 @@ class WheelFile(ZipFile): raise WheelError('Missing {} file'.format(self.record_path)) with record: - for line in record: - line = line.decode('utf-8') - path, hash_sum, size = line.rsplit(u',', 2) - if hash_sum: - algorithm, hash_sum = hash_sum.split(u'=') - try: - hashlib.new(algorithm) - except ValueError: - raise WheelError('Unsupported hash algorithm: {}'.format(algorithm)) + for line in read_csv(record): + path, hash_sum, size = line + if not hash_sum: + continue - if algorithm.lower() in {'md5', 'sha1'}: - raise WheelError( - 'Weak hash algorithm ({}) is not permitted by PEP 427' - .format(algorithm)) + algorithm, hash_sum = hash_sum.split(u'=') + try: + hashlib.new(algorithm) + except ValueError: + raise WheelError('Unsupported hash algorithm: {}'.format(algorithm)) - self._file_hashes[path] = ( - algorithm, urlsafe_b64decode(hash_sum.encode('ascii'))) + if algorithm.lower() in {'md5', 'sha1'}: + raise WheelError( + 'Weak hash algorithm ({}) is not permitted by PEP 427' + .format(algorithm)) + + self._file_hashes[path] = ( + algorithm, urlsafe_b64decode(hash_sum.encode('ascii'))) def open(self, name_or_info, mode="r", pwd=None): def _update_crc(newdata, eof=None):