aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-07-03 15:13:01 -0400
committerGitHub <noreply@github.com>2020-07-03 15:13:01 -0400
commit990237c64404876791dc5985e7cfd260852dac0e (patch)
treeeb721c8957ee48c5149af6742a27a449fb618027 /setuptools/command/easy_install.py
parenta877dab0bddaeb5503d871794ca06f1c81d805b8 (diff)
parent5f151cbbcd6c65f7f48082bfaf36db3a55df936e (diff)
downloadexternal_python_setuptools-990237c64404876791dc5985e7cfd260852dac0e.tar.gz
external_python_setuptools-990237c64404876791dc5985e7cfd260852dac0e.tar.bz2
external_python_setuptools-990237c64404876791dc5985e7cfd260852dac0e.zip
Merge pull request #2199 from cool-RR/2020-06-11-raise-from
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 5808a190..bcbd4f58 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -355,8 +355,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(
@@ -757,9 +759,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:
@@ -1148,7 +1150,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']