ó
è¾bc           @   s…   d  Z  d d l m Z d d l m Z m Z d d l Z d d l Z d d l Z d e f d „  ƒ  YZ	 d „  Z
 d „  Z d	 „  Z d S(
   s†   distutils.command.install_egg_info

Implements the Distutils 'install_egg_info' command, for installing
a package's PKG-INFO metadata.iÿÿÿÿ(   t   Command(   t   logt   dir_utilNt   install_egg_infoc           B   sD   e  Z d  Z d Z d d g Z d „  Z d „  Z d	 „  Z d
 „  Z	 RS(   s)   Install an .egg-info file for the packages8   Install package's PKG-INFO metadata as an .egg-info files   install-dir=t   ds   directory to install tos   install-layouts   custom installation layoutc         C   s   d  |  _ d  |  _ d  |  _ d  S(   N(   t   Nonet   install_dirt   install_layoutt   prefix_option(   t   self(    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyt   initialize_options   s    		c         C   sa  |  j  d d ƒ |  j  d d ƒ |  j  d d ƒ |  j rš d t t |  j j ƒ  ƒ ƒ t t |  j j ƒ  ƒ ƒ f } |  j j ƒ  d k r3t	 d ƒ ‚ q3n™ |  j
 s² d	 t j k rù d
 t t |  j j ƒ  ƒ ƒ t t |  j j ƒ  ƒ ƒ t j d  f } n: d t t |  j j ƒ  ƒ ƒ t t |  j j ƒ  ƒ ƒ f } t j j |  j | ƒ |  _ |  j g |  _ d  S(   Nt   install_libR   t   installR   R   s   %s-%s.egg-infot   debs"   unknown value for --install-layoutt   real_prefixs   %s-%s-py%s.egg-infoi   (   R   R   (   R   R   (   R   R   (   R   (   t   set_undefined_optionsR   t   to_filenamet	   safe_namet   distributiont   get_namet   safe_versiont   get_versiont   lowert   DistutilsOptionErrorR   t   syst   __dict__t   versiont   ost   patht   joinR   t   targett   outputs(   R	   t   basename(    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyt   finalize_options   s(    	c         C   s  |  j  } t j j | ƒ rG t j j | ƒ rG t j | d |  j ƒnp t j j | ƒ r| |  j	 t j
 |  j  f d | ƒ n; t j j |  j ƒ s· |  j	 t j |  j f d |  j ƒ n  t j d | ƒ |  j sÿ t | d ƒ } |  j j j | ƒ | j ƒ  n  d  S(   Nt   dry_runs	   Removing s	   Creating s
   Writing %st   w(   R   R   R   t   isdirt   islinkR   t   remove_treeR"   t   existst   executet   unlinkR   t   makedirsR   t   infot   openR   t   metadatat   write_pkg_filet   close(   R	   R   t   f(    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyt   run3   s    	%#	c         C   s   |  j  S(   N(   R   (   R	   (    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyt   get_outputsB   s    (   s   install-dir=R   s   directory to install toN(   s   install-layoutNs   custom installation layout(
   t   __name__t
   __module__t   __doc__t   descriptionR   t   user_optionsR
   R!   R1   R2   (    (    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyR      s   				c         C   s   t  j d d |  ƒ S(   s   Convert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    s   [^A-Za-z0-9.]+t   -(   t   ret   sub(   t   name(    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyR   J   s    c         C   s%   |  j  d d ƒ }  t j d d |  ƒ S(   sÌ   Convert an arbitrary string to a standard version string

    Spaces become dots, and all other non-alphanumeric characters become
    dashes, with runs of multiple dashes condensed to a single dash.
    t    t   .s   [^A-Za-z0-9.]+R8   (   t   replaceR9   R:   (   R   (    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyR   R   s    c         C   s   |  j  d d ƒ S(   s|   Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    R8   t   _(   R>   (   R;   (    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyR   \   s    (   R5   t   distutils.cmdR    t	   distutilsR   R   R   R   R9   R   R   R   R   (    (    (    s8   /usr/lib/python2.7/distutils/command/install_egg_info.pyt   <module>   s   $?		
