1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Remove six import from src/pip/_internal/req/req_install.py

Use Python 3 `raise exc from ...` semantics to replace the use of
six.reraise.
This commit is contained in:
Jon Dufresne 2021-08-08 09:44:15 -07:00
parent d3a78ebbfe
commit cf7183d875
3 changed files with 5 additions and 7 deletions

View file

@ -3,7 +3,6 @@
import logging
import os
import sys
from distutils.util import change_root
from typing import List, Optional, Sequence
@ -20,8 +19,7 @@ logger = logging.getLogger(__name__)
class LegacyInstallFailure(Exception):
def __init__(self) -> None:
self.parent = sys.exc_info()
pass
def write_installed_files_from_setuptools_record(
@ -111,9 +109,9 @@ def install(
# Signal to the caller that we didn't install the new package
return False
except Exception:
except Exception as e:
# Signal to the caller that we didn't install the new package
raise LegacyInstallFailure
raise LegacyInstallFailure from e
# At this point, we have successfully installed the requirement.

View file

@ -9,7 +9,7 @@ import uuid
import zipfile
from typing import Any, Dict, Iterable, List, Optional, Sequence, Union
from pip._vendor import pkg_resources, six
from pip._vendor import pkg_resources
from pip._vendor.packaging.markers import Marker
from pip._vendor.packaging.requirements import Requirement
from pip._vendor.packaging.specifiers import SpecifierSet
@ -795,7 +795,7 @@ class InstallRequirement:
)
except LegacyInstallFailure as exc:
self.install_succeeded = False
six.reraise(*exc.parent)
raise exc.__cause__
except Exception:
self.install_succeeded = True
raise