???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................ó
fc           @   s´   d  d l  Z  d  d l Z d  d l Z d  d l Td  d l Z e  j j Z e Z e  j	 j Z
 d a d „  Z e j d ƒ Z d „  Z d „  Z d „  Z d „  Z e d	 k r° e ƒ  n  d S(
   iÿÿÿÿN(   t   *c          C   sp  d t  j d }  y# t j t  j d d ƒ \ } } Wn; t j k
 rq } t | d ƒ t |  ƒ t  j d ƒ n Xx) | D]! \ } } | d k ry | a qy qy Wt s¼ t d d k s¼ | rà t d	 ƒ t |  ƒ t  j d ƒ n  d } xv | D]n } t j j	 | ƒ rt
 | ƒ r[d } q[qí t j j | ƒ rFt | d
 ƒ d } qí t | ƒ rí d } qí qí Wt  j | ƒ d  S(   Ns0   usage: %s -i /interpreter file-or-directory ...
i    i   s   i:s   
i   s   -it   /s'   -i option or file-or-directory missing
s"   : will not process symbolic links
(   t   syst   argvt   getoptt   errort   errt   exitt   new_interpretert   ost   patht   isdirt   recursedownt   islinkt   fix(   t   usaget   optst   argst   msgt   ot   at   badt   arg(    (    s-   /usr/lib64/python2.7/Tools/scripts/pathfix.pyt   main"   s4    #


 	 s   ^[a-zA-Z0-9_]+\.py$c         C   s   t  j |  ƒ d k S(   Ni    (   t   ispythonprogt   match(   t   name(    (    s-   /usr/lib64/python2.7/Tools/scripts/pathfix.pyt   ispython?   s    c         C   s1  t  d |  f ƒ d } y t j |  ƒ } Wn+ t j k
 rW } t d |  | f ƒ d SX| j ƒ  g  } xœ | D]” } | t j t j f k r“ qo n  t j j	 |  | ƒ } t j j
 | ƒ r½ qo t j j | ƒ rß | j | ƒ qo t | ƒ ro t | ƒ rd } qqo qo Wx# | D] } t | ƒ rd } qqW| S(   Ns   recursedown(%r)
i    s   %s: cannot list directory: %r
i   (   t   dbgR	   t   listdirR   R   t   sortt   curdirt   pardirR
   t   joinR   R   t   appendR   R   R   (   t   dirnameR   t   namesR   t   subdirsR   t   fullname(    (    s-   /usr/lib64/python2.7/Tools/scripts/pathfix.pyR   B   s0    
    c         C   s<  y t  |  d ƒ } Wn( t k
 r= } t d |  | f ƒ d SX| j ƒ  } t | ƒ } | | k r~ t |  d ƒ | j ƒ  d  St j j	 |  ƒ \ } } t j j
 | d | ƒ } y t  | d ƒ } Wn2 t k
 rö } | j ƒ  t d | | f ƒ d SXt |  d ƒ | j | ƒ d }	 x* | j |	 ƒ }
 |
 s4Pn  | j |
 ƒ qW| j ƒ  | j ƒ  y+ t j |  ƒ } t j | | t d @ƒ Wn* t j k
 r°} t d | | f ƒ n Xy t j |  |  d ƒ Wn* t j k
 rõ} t d |  | f ƒ n Xy t j | |  ƒ Wn+ t j k
 r7} t d |  | f ƒ d SXd S(   Nt   rs   %s: cannot open: %r
i   s   : no change
t   @t   ws   %s: cannot create: %r
s   : updating
i   i   iÿ  s   %s: warning: chmod failed (%r)
t   ~s    %s: warning: backup failed (%r)
s   %s: rename failed (%r)
i    i    (   t   opent   IOErrorR   t   readlinet   fixlinet   rept   closeR	   R
   t   splitR!   t   writet   readt   statt   chmodt   ST_MODER   t   rename(   t   filenamet   fR   t   linet   fixedt   headt   tailt   tempnamet   gt   BUFSIZEt   buft   statbuf(    (    s-   /usr/lib64/python2.7/Tools/scripts/pathfix.pyR   X   sX    

 

c         C   s+   |  j  d ƒ s |  Sd |  k r# |  Sd t S(   Ns   #!t   pythons   #! %s
(   t
   startswithR   (   R:   (    (    s-   /usr/lib64/python2.7/Tools/scripts/pathfix.pyR.      s
    t   __main__(   R   t   reR	   R4   R   t   stderrR2   R   R   t   stdoutR/   t   NoneR   R   t   compileR   R   R   R   R.   t   __name__(    (    (    s-   /usr/lib64/python2.7/Tools/scripts/pathfix.pyt   <module>   s    
				5	