aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorRam Rachum <ram@rachum.com>2020-06-16 13:31:12 +0300
committerRam Rachum <ram@rachum.com>2020-06-28 22:20:23 +0300
commita9eb9e73def8ca6c469e59f1b008746e368ad4c1 (patch)
tree8c31a8e9003fd08f998ecc691d57ab08637926ce /setuptools/command/easy_install.py
parent308314268233cc56e7a8c5870fec75b566230411 (diff)
downloadexternal_python_setuptools-a9eb9e73def8ca6c469e59f1b008746e368ad4c1.tar.gz
external_python_setuptools-a9eb9e73def8ca6c469e59f1b008746e368ad4c1.tar.bz2
external_python_setuptools-a9eb9e73def8ca6c469e59f1b008746e368ad4c1.zip
Fix exception causes all over the codebase
Diffstat (limited to 'setuptools/command/easy_install.py')
-rw-r--r--setuptools/command/easy_install.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 27b4558b..8890ec88 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -356,8 +356,10 @@ class easy_install(Command):
self.optimize = int(self.optimize)
if not (0 <= self.optimize <= 2):
raise ValueError
- except ValueError:
- raise DistutilsOptionError("--optimize must be 0, 1, or 2")
+ except ValueError as e:
+ raise DistutilsOptionError(
+ "--optimize must be 0, 1, or 2"
+ ) from e
if self.editable and not self.build_directory:
raise DistutilsArgError(
@@ -765,9 +767,9 @@ class easy_install(Command):
[requirement], self.local_index, self.easy_install
)
except DistributionNotFound as e:
- raise DistutilsError(str(e))
+ raise DistutilsError(str(e)) from e
except VersionConflict as e:
- raise DistutilsError(e.report())
+ raise DistutilsError(e.report()) from e
if self.always_copy or self.always_copy_from:
# Force all the relevant distros to be copied or activated
for dist in distros:
@@ -1156,7 +1158,9 @@ class easy_install(Command):
try:
run_setup(setup_script, args)
except SystemExit as v:
- raise DistutilsError("Setup script exited with %s" % (v.args[0],))
+ raise DistutilsError(
+ "Setup script exited with %s" % (v.args[0],)
+ ) from v
def build_and_install(self, setup_script, setup_base):
args = ['bdist_egg', '--dist-dir']