diff --git a/CHANGES.txt b/CHANGES.txt index c29c3a783eb..a35c6f8ed1a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,9 @@ * Make ``install --quiet`` really quiet. See #3418. +* Fix a bug when removing packages in python 3: disable INI-style parsing of the + entry_point.txt file to allow entry point names with colons (:pull:`3434`) + **8.0.2 (2016-01-21)** diff --git a/pip/req/req_install.py b/pip/req/req_install.py index 3b48431cd64..b3076e55836 100644 --- a/pip/req/req_install.py +++ b/pip/req/req_install.py @@ -727,7 +727,11 @@ def uninstall(self, auto_confirm=False): # find console_scripts if dist.has_metadata('entry_points.txt'): - config = configparser.SafeConfigParser() + if six.PY2: + options = {} + else: + options = {"delimiters": ('=', )} + config = configparser.SafeConfigParser(**options) config.readfp( FakeFile(dist.get_metadata_lines('entry_points.txt')) ) diff --git a/setup.py b/setup.py index 43bab40282f..488ff089907 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,8 @@ def find_version(*file_paths): long_description = read('README.rst') -tests_require = ['pytest', 'virtualenv>=1.10', 'scripttest>=1.3', 'mock'] +tests_require = ['pytest', 'virtualenv>=1.10', 'scripttest>=1.3', 'mock', + 'pretend'] setup( diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py index d3e7c35048f..882d1454a32 100644 --- a/tests/functional/test_uninstall.py +++ b/tests/functional/test_uninstall.py @@ -154,6 +154,32 @@ def test_uninstall_overlapping_package(script, data): assert_all_changes(result2, result3, []) +def test_uninstall_entry_point(script): + """ + Test uninstall package with two or more entry points in the same section, + whose name contain a colon. + """ + script.scratch_path.join("ep_install").mkdir() + pkg_path = script.scratch_path / 'ep_install' + pkg_path.join("setup.py").write(textwrap.dedent(""" + from setuptools import setup + setup( + name='ep-install', + version='0.1', + entry_points={"pip_test.ep": + ["ep:name1 = distutils_install", + "ep:name2 = distutils_install"] + } + ) + """)) + result = script.pip('install', pkg_path) + result = script.pip('list') + assert "ep-install (0.1)" in result.stdout + script.pip('uninstall', 'ep_install', '-y') + result2 = script.pip('list') + assert "ep-install (0.1)" not in result2.stdout + + @pytest.mark.network def test_uninstall_console_scripts(script): """