Skip to content
Snippets Groups Projects
Commit e22140d4 authored by Yngve Levinsen's avatar Yngve Levinsen
Browse files

added installed module (helper)

parent f21f1be6
No related branches found
No related tags found
Loading
import TraceWin
import installed
def get_installed_packages():
'''
Returns a dictionary of installed packages
Example usage:
(print all packages):
for package in get_installed_packages():
print package
'''
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
return installed_packages
def is_package_installed(name):
'''
Returns a bool, true if package name
was found in one of the string representations
of any package.
case insensitive (meaning Package==package)
'''
name=name.lower()
ret=False
for package in get_installed_packages():
if name in str(package).lower():
print "Found",package
ret=True
return ret
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment