Skip to content

[Py3] Remove package containing entry points names with colons #3434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)**

Expand Down
6 changes: 5 additions & 1 deletion pip/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
26 changes: 26 additions & 0 deletions tests/functional/test_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down