Permalink
Browse files

Removed logging silence hack from search

  • Loading branch information...
1 parent 388f3d9 commit 0b3e1b53ef56eb00e1e1198cd67c912eea263418 @michaeta committed May 11, 2012
Showing with 4 additions and 29 deletions.
  1. +4 −29 pip2/commands/search.py
View
33 pip2/commands/search.py
@@ -8,56 +8,31 @@
containing information about the package.
"""
-import logging
-
import pip2.commands.freeze
from pip2.compat import packaging
-pkg_logger = logging.getLogger("packaging")
-old_lvl = pkg_logger.getEffectiveLevel()
-
-
def search(package):
"""
Searches the PYPIs for packages based off of
the 'package' parameter, the default is the http://python.org/pypi index
"""
results = dict()
-
- # temp for future ref, fail gracefully
- try:
- client = packaging.pypi.xmlrpc.Client()
- except:
- raise
-
- # don't display irrational version warnings
- pkg_logger.setLevel(logging.ERROR)
- # temp for future ref
- try:
- projects = client.search_projects(name=package, summary=package)
- except:
- raise
- finally:
- pkg_logger.setLevel(old_lvl)
+ client = packaging.pypi.xmlrpc.Client()
+ projects = client.search_projects(name=package, summary=package)
installed = pip2.commands.freeze.freeze()
for project in projects:
results[project.name] = dict()
- # temp for future ref.
- # Sometimes a release can't be found or
- # version number can't be rationalized
+ # if all releases for a project have irrational versions then the
+ # releases list will be empty
try:
- # get the latest release
project.sort_releases()
release = project.releases[0]
except IndexError:
results[project.name]['summary'] = "CANNOT GET SUMMARY"
else:
results[project.name]['summary'] = release.metadata['summary']
- #f = results[project.name]['summary']
- #f = f.replace('\n', ' ').replace('\t', ' ').replace(' ', ' ')
- #results[project.name]['summary'] = f
if project.name in installed.keys():
results[project.name]['installed_version'] = \
installed[project.name]['version']

0 comments on commit 0b3e1b5

Please sign in to comment.