aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOfek Lev <ofekmeister@gmail.com>2020-06-14 14:21:26 -0400
committerOfek Lev <ofekmeister@gmail.com>2020-06-14 14:21:26 -0400
commitd6501f3c75384340f1742a864c1ffa76977437b6 (patch)
tree56a750c13be0d4e49e3e7842f240e980b8507714
parent01121d057bea0128c34a92813c51ba3ec4902fce (diff)
downloadexternal_python_setuptools-d6501f3c75384340f1742a864c1ffa76977437b6.tar.gz
external_python_setuptools-d6501f3c75384340f1742a864c1ffa76977437b6.tar.bz2
external_python_setuptools-d6501f3c75384340f1742a864c1ffa76977437b6.zip
address
-rw-r--r--setuptools/command/easy_install.py6
-rw-r--r--setuptools/tests/test_easy_install.py6
2 files changed, 4 insertions, 8 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index a82b1655..15e46cfc 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -2070,9 +2070,7 @@ class ScriptWriter:
gui apps.
"""
- try:
- from importlib.metadata import distribution # noqa: F401
-
+ if sys.version_info >= (3, 8):
template = textwrap.dedent(r"""
# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r
__requires__ = %(spec)r
@@ -2086,7 +2084,7 @@ class ScriptWriter:
if entry_point.group == %(group)r and entry_point.name == %(name)r:
sys.exit(entry_point.load()())
""").lstrip() # noqa: E501
- except ImportError:
+ else:
template = textwrap.dedent(r"""
# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r
__requires__ = %(spec)r
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 58108db6..9aa2bd63 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -71,9 +71,7 @@ class TestEasyInstallTest:
def test_get_script_args(self):
header = ei.CommandSpec.best().from_environment().as_header()
- try:
- from importlib.metadata import distribution # noqa: F401
-
+ if sys.version_info >= (3, 8):
expected = header + DALS(r"""
# EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
__requires__ = 'spec'
@@ -87,7 +85,7 @@ class TestEasyInstallTest:
if entry_point.group == 'console_scripts' and entry_point.name == 'name':
sys.exit(entry_point.load()())
""") # noqa: E501
- except ImportError:
+ else:
expected = header + DALS(r"""
# EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
__requires__ = 'spec'