diff options
author | Steve Kowalik <steven@wedontsleep.org> | 2016-09-13 10:54:45 +1200 |
---|---|---|
committer | Steve Kowalik <steven@wedontsleep.org> | 2016-09-13 10:54:45 +1200 |
commit | 1f23f9a25e6c91554954185e84497056062093be (patch) | |
tree | 9660c20ee817c2cd4e4872492194591282517d12 /setuptools/command/easy_install.py | |
parent | 2388233e4106937064bf1cdb087e7e1cfc5c7ea7 (diff) | |
download | external_python_setuptools-1f23f9a25e6c91554954185e84497056062093be.tar.gz external_python_setuptools-1f23f9a25e6c91554954185e84497056062093be.tar.bz2 external_python_setuptools-1f23f9a25e6c91554954185e84497056062093be.zip |
Don't duplicate error case in package_index
easy_install has code to handle parsing a requirement, catching the
ValueError and then raising a DistUtilsError. This code was entirely
duplicated in package_index, so I've slightly refactored to remove
the duplication.
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-x | setuptools/command/easy_install.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index e8b90c70..a3792ce2 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -49,8 +49,9 @@ from setuptools.sandbox import run_setup from setuptools.py31compat import get_path, get_config_vars from setuptools.command import setopt from setuptools.archive_util import unpack_archive -from setuptools.package_index import PackageIndex -from setuptools.package_index import URL_SCHEME +from setuptools.package_index import ( + PackageIndex, parse_requirement_arg, URL_SCHEME, +) from setuptools.command import bdist_egg, egg_info from pkg_resources import ( yield_lines, normalize_path, resource_string, ensure_directory, @@ -1522,15 +1523,6 @@ def get_exe_prefixes(exe_filename): return prefixes -def parse_requirement_arg(spec): - try: - return Requirement.parse(spec) - except ValueError: - raise DistutilsError( - "Not a URL, existing file, or requirement spec: %r" % (spec,) - ) - - class PthDistributions(Environment): """A .pth file with Distribution paths in it""" |