관리-도구
편집 파일: search.cpython-34.pyc
� �Re� � @ s d d l Z d d l Z d d l Z d d l m Z m Z d d l m Z d d l m Z d d l m Z m Z m Z d d l m Z d d l m Z d d l m Z d d l m Z m Z Gd d � d e � Z d d � Z d d d d � Z d d � Z d d � Z d S)� N)�Command�SUCCESS)�get_terminal_size)�logger)� xmlrpclib�reduce�cmp)�CommandError)�NO_MATCHES_FOUND)� pkg_resources)� StrictVersion�LooseVersionc sR e Z d Z d Z d Z d Z d Z � f d d � Z d d � Z d d � Z � S)� SearchCommandz@Search for PyPI packages whose name or summary contains <query>.�searchz %prog [options] <query>zSearch PyPI for packages.c s[ t t | � j | | � | j j d d d d d d d d d �| j j d | j � d S)Nz--index�dest�index�metavar�URL�defaultzhttps://pypi.python.org/pypi�helpz3Base URL of Python Package Index (default %default)r )�superr �__init__�cmd_opts� add_option�parser�insert_option_group)�self�args�kw)� __class__� �./tmp/pip-ztkk0jow-build/pip/commands/search.pyr s zSearchCommand.__init__c C s� | s t d � � n | } | j } | j | | � } t | � } d } t j j � rg t � d } n t | d | �| r� t St S)Nz)Missing required argument (search query).r �terminal_width)r r r �transform_hits�sys�stdout�isattyr � print_resultsr r )r �optionsr �query� index_url� pypi_hits�hitsr"