ó
@K7]c           @   s–   d  d l  Z  d  d l m Z d  d l m Z d  d l Z d  d l m Z m Z m Z d  d l	 m
 Z
 e  j d e  j ƒ d „  Z d „  Z d	 „  Z d S(
   iÿÿÿÿN(   t
   expanduser(   t   pprint(   t   ArgumentParsert   add_parser_prefixt
   get_prefix(   t   apit   levelc      
   C   sÎ  t  d d d d ƒ } | j d d ƒ } d } | j d d	 | d | ƒ} | j d
 d d d d d	 d ƒ| j d d d d	 d ƒ| j d d d d	 d ƒ| j d d d d d d d; d	 d ƒ| j d d d d	 d d d ƒ| j d d d d	 d ƒt | ƒ d  } | j d! d	 | d | ƒ} | j d
 d d d d d	 d ƒ| j d d d d	 d" ƒ| j d d d d d# d d< d	 d& ƒ| j d d d d	 d ƒt | ƒ d' } | j d( d	 | d | ƒ} | j d) d d d	 d* ƒ| j d+ d, d d d	 d- ƒ| j d. d d/ d d0 d	 d1 ƒ| j d2 d	 d3 d | ƒ}	 |	 j d
 d d d d4 d	 d ƒ|	 j d5 d6 d	 d7 d t j ƒ  j d8 t ƒ| j d9 d	 d: d d: ƒ}
 |
 j d
 d d d d d	 d ƒ| j	 |  ƒ }  | |  f S(=   Nt   descriptions$   Tools for inspecting conda packages.t   epilogsj   
Run --help on the subcommands like 'conda inspect linkages --help' to see the
options available.
        t   destt
   subcommandsl  
Investigates linkages of binary libraries in a package (works in Linux and
OS X). This is an advanced command to aid building packages that link against
C libraries. Aggregates the output of ldd (on Linux) and otool -L (on OS X) by
dependent packages. Useful for finding broken links, or links against system
libraries that ought to be dependent conda packages.  t   linkagest   helpt   packagest   actiont   storet   nargst   *s   Conda packages to inspect.s   --untrackedt
   store_trues~   Inspect the untracked files in the environment. This is useful when used in
        conjunction with conda build --build-only.s   --show-filess7   Show the files in the package that link to each librarys	   --groupbyt   defaultt   packaget   choicest
   dependencysa   Attribute to group by (default: %(default)s). Useful when used
        in conjunction with --all.s	   --sysroots2   System root in which to look for system libraries.t    s   --alls6   Generate a report for all packages in the environment.sã   
Investigate binary object files in a package (only works on OS X). This is an
advanced command to aid building packages that have compiled
libraries. Aggregates the output of otool on all the binary object files in a
package.
t   objectss~   Inspect the untracked files in the environment. This is useful when used
        in conjunction with conda build --build-only.t   filenamet   filetypet   rpaths-   Attribute to group by (default: %(default)s).s)   
Tools for investigating conda channels.
t   channelss	   --verbosesl   Show verbose output. Note that error output to stderr will
        always be shown regardless of this flag. s   --test-installables   -tsO   Test every package in the channel to see if it is installable
        by conda.t   channelt   ?t   defaultss0   The channel to test. The default is %(default)s.s   prefix-lengthsse   Inspect packages in given path, finding those with binary
            prefixes shorter than specifiedt   +s   --min-prefix-lengths   -msB   Minimum length.  Only packages with prefixes below this are shown.t   types   hash-inputss=   Show data used to compute hash identifier (h????) for package(   R   R   (   R   R   R   (
   R   t   add_subparserst
   add_parsert   add_argumentR   R   t   Configt   prefix_lengtht   intt
   parse_args(   t   argst   pR
   t   linkages_helpR   t   objects_helpR   t   channels_helpR   t   prefix_lengthst   hash_inputs(    (    s;   lib/python2.7/site-packages/conda_build/cli/main_inspect.pyR(      sÖ    				
	
					c         C   s†  t  |  ƒ \ } }  |  j s/ | j ƒ  t ƒ  nS|  j d k rk |  j sW | j d ƒ q‚t j |  j ƒ GHn|  j d k rÍ t j |  j	 d t
 |  ƒ d |  j d |  j d |  j d |  j d	 t |  j ƒ ƒGHnµ |  j d
 k rt j |  j	 d t
 |  ƒ d |  j ƒGHn} |  j d k rBt j |  j	 d |  j ƒs‚t j d ƒ q‚n@ |  j d k rjt t j |  j	 ƒ ƒ n t d j |  j ƒ ƒ ‚ d  S(   NR   s5   At least one option (--test-installable) is required.R   t   prefixt	   untrackedt   all_packagest
   show_filest   groupbyt   sysrootR   s   prefix-lengthst   min_prefix_lengthi   s   hash-inputss   Unrecognized subcommand: {0}.(   R(   R
   t
   print_helpt   exitt   test_installablet   errorR   R   t   inspect_linkagesR   R   R1   t   allR3   R4   R    R5   t   inspect_objectst   inspect_prefix_lengthR6   t   sysR   t   inspect_hash_inputst
   ValueErrort   format(   R)   t   parser(    (    s;   lib/python2.7/site-packages/conda_build/cli/main_inspect.pyt   execute¶   s*    	

	)c           C   s   t  t j d ƒ S(   Ni   (   RD   R?   t   argv(    (    (    s;   lib/python2.7/site-packages/conda_build/cli/main_inspect.pyt   mainÒ   s    (   t   loggingt   os.pathR    R   R?   t   conda_build.conda_interfaceR   R   R   t   conda_buildR   t   basicConfigt   INFOR(   RD   RF   (    (    (    s;   lib/python2.7/site-packages/conda_build/cli/main_inspect.pyt   <module>   s   	£	