sjkingo/virtualenv-api

Packages with capitalized names give the wrong result for is_installed

irvinlim opened this issue · 0 comments

Try this:

$ pip install Pillow
$ ipython
Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.1.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from virtualenvapi.manage import VirtualEnvironment

In [2]: env = VirtualEnvironment('.venv')

In [3]: env.installed_package_names
Out[3]:
[
 ...
 'pillow',
 'pip',
 ...
]

In [4]: env.is_installed('Pillow')
Out[4]: False

In [5]: env.installed_packages
Out[5]:
[
 ('Pillow', '5.3.0'),
 ('pip', '18.1'),
 ...
]

It looks like installed_package_names would lowercase all the package names, so the check for whether the package is installed would wrongly return False.