Skip to content

Commit 3455016

Browse files
committed
Merge pull request #3434 from montefra/fix_uninstall_colon
[Py3] Remove package containing entry points names with colons
2 parents 838d249 + 3c85765 commit 3455016

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
* Make ``install --quiet`` really quiet. See #3418.
44

5+
* Fix a bug when removing packages in python 3: disable INI-style parsing of the
6+
entry_point.txt file to allow entry point names with colons (:pull:`3434`)
7+
58

69
**8.0.2 (2016-01-21)**
710

pip/req/req_install.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,11 @@ def uninstall(self, auto_confirm=False):
727727

728728
# find console_scripts
729729
if dist.has_metadata('entry_points.txt'):
730-
config = configparser.SafeConfigParser()
730+
if six.PY2:
731+
options = {}
732+
else:
733+
options = {"delimiters": ('=', )}
734+
config = configparser.SafeConfigParser(**options)
731735
config.readfp(
732736
FakeFile(dist.get_metadata_lines('entry_points.txt'))
733737
)

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def find_version(*file_paths):
4141

4242
long_description = read('README.rst')
4343

44-
tests_require = ['pytest', 'virtualenv>=1.10', 'scripttest>=1.3', 'mock']
44+
tests_require = ['pytest', 'virtualenv>=1.10', 'scripttest>=1.3', 'mock',
45+
'pretend']
4546

4647

4748
setup(

tests/functional/test_uninstall.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,32 @@ def test_uninstall_overlapping_package(script, data):
154154
assert_all_changes(result2, result3, [])
155155

156156

157+
def test_uninstall_entry_point(script):
158+
"""
159+
Test uninstall package with two or more entry points in the same section,
160+
whose name contain a colon.
161+
"""
162+
script.scratch_path.join("ep_install").mkdir()
163+
pkg_path = script.scratch_path / 'ep_install'
164+
pkg_path.join("setup.py").write(textwrap.dedent("""
165+
from setuptools import setup
166+
setup(
167+
name='ep-install',
168+
version='0.1',
169+
entry_points={"pip_test.ep":
170+
["ep:name1 = distutils_install",
171+
"ep:name2 = distutils_install"]
172+
}
173+
)
174+
"""))
175+
result = script.pip('install', pkg_path)
176+
result = script.pip('list')
177+
assert "ep-install (0.1)" in result.stdout
178+
script.pip('uninstall', 'ep_install', '-y')
179+
result2 = script.pip('list')
180+
assert "ep-install (0.1)" not in result2.stdout
181+
182+
157183
@pytest.mark.network
158184
def test_uninstall_console_scripts(script):
159185
"""

0 commit comments

Comments
 (0)