Ñò
S@uJc           @   s?  d  d k  Z d  d k Z d  d k Z d  d k Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d e f d „  ƒ  YZ
 d e
 f d	 „  ƒ  YZ d
 e
 f d „  ƒ  YZ d e
 f d „  ƒ  YZ d e
 f d „  ƒ  YZ d e i f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   iÿÿÿÿNt	   DeployLogc           B   s2   e  Z d  Z g  d „ Z d „  Z e d „  ƒ Z RS(   s<   Equivalent to .scripts-version: a series of DeployRevisions.c         C   s   t  i |  | ƒ d S(   s&   `revs`  List of DeployRevision objectsN(   t   listt   __init__(   t   selft   revs(    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR      s    c         C   s   d t  i |  ƒ S(   Ns   <DeployLog %s>(   R   t   __repr__(   R   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR      s    c      
      s  |  i  ‰ d ‰  t ƒ  } g  ‰ ‡  ‡ ‡ f d †  } y t ˆ ƒ } Wn t j
 o t ˆ ƒ ‚ n Xx| D]} | i ƒ  } | p  | | ƒ d ‰  t ƒ  } ql n ˆ  d j o t i i | ƒ | _	 n¤ ˆ  d j o | | _
 nŠ ˆ  d j o t i | ƒ | _ ng ˆ  d j oM y t i i i | ƒ | _ Wqnt i j
 o } |  i | _ | ‚ qnXn t ˆ ƒ ‚ ˆ  d 7‰  ql W| | ƒ t ˆ ƒ S(   s\   Loads a scripts version file and parses it into
        DeployLog and DeployRevision objectsi    c            s9   ˆ  o. ˆ  d j o t  ˆ ƒ ‚ n ˆ i |  ƒ n d  S(   Ni   (   t"   ScriptsVersionNotEnoughFieldsErrort   append(   t   rev(   t   iR   t   file(    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR      s    i   i   i   (   t   old_version_filet   DeployRevisiont   opent   IOErrort   ScriptsVersionNoSuchFilet   rstript   dateutilt   parsert   parset   datetimet   usert   DeploySourcet   sourcet   wizardt   deployt   ApplicationVersiont   versiont   Errort   locationt    ScriptsVersionTooManyFieldsErrorR    (   t
   deploymentR   R   t   fht   linet   e(    (   R	   R
   R   s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyt   load   sB    		 
	
(   t   __name__t
   __module__t   __doc__R   R   t   staticmethodR#   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR    
   s   	R   c           B   s#   e  Z d  Z d d d d d „ Z RS(   s|   A single entry in the .scripts-version file. Contains who deployed
    this revision, what application version this is, etc.c         C   s(   | |  _  | |  _ | |  _ | |  _ d S(   s    `datetime`  Time this revision was deployed
            `user`      Person who deployed this revision, in user@host format.
            `source`    Instance of DeploySource
            `version`   Instance of ApplicationVersion
        Note: This object is typically built incrementally.N(   R   R   R   R   (   R   R   R   R   R   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   E   s    			N(   R$   R%   R&   t   NoneR   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   B   s   R   c           B   s&   e  Z d  Z d „  Z e d „  ƒ Z RS(   s5   Source of the deployment; see subclasses for examplesc         C   s
   t  ‚ d  S(   N(   t   NotImplementedError(   R   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   R   s    c         C   sÀ   t  i i |  d ƒ } | i d ƒ } | d d j o t ƒ  S| d d j p | d d j oW | d d j } y- | d d j o t | ƒ St |  | ƒ SWq¶ t j
 o q¶ Xn t |  ƒ S(	   Ns$   /afs/athena.mit.edu/contrib/scripts/t   /i    R   R   t	   deploydevi   t   updates(	   t   ost   patht   relpatht   splitt   WizardUpdatet	   OldUpdatet   TarballInstallt
   IndexErrort   UnknownDeploySource(   R!   t   relt   partst   isDev(    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   T   s    "	(   R$   R%   R&   R   R'   R   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   P   s   	R3   c           B   s   e  Z d  Z d „  Z RS(   sy   Original installation from tarball, characterized by
    /afs/athena.mit.edu/contrib/scripts/deploy/APP-x.y.z.tar.gz
    c         C   s   | |  _  | |  _ d  S(   N(   R   R8   (   R   R   R8   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   j   s    	(   R$   R%   R&   R   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR3   f   s   R2   c           B   s   e  Z d  Z d „  Z RS(   s“   Upgrade using old upgrade infrastructure, characterized by
    /afs/athena.mit.edu/contrib/scripts/deploydev/updates/update-scripts-version.pl
    c         C   s   | |  _  d  S(   N(   R8   (   R   R8   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   r   s    (   R$   R%   R&   R   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR2   n   s   R1   c           B   s   e  Z d  Z d „  Z RS(   s…   Upgrade using wizard infrastructure, characterized by
    /afs/athena.mit.edu/contrib/scripts/wizard/bin/wizard HASHGOBBLEDYGOOK
    c         C   s   d  S(   N(    (   R   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   y   s    (   R$   R%   R&   R   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR1   u   s   R5   c           B   s   e  Z d  Z d „  Z RS(   s2   Deployment that we don't know the meaning of. Wot!c         C   s   | |  _  d  S(   N(   R!   (   R   R!   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   ~   s    (   R$   R%   R&   R   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR5   |   s   R   c           B   s   e  Z d  Z RS(   s    Base error class for log errors.(   R$   R%   R&   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   ƒ   s   t   ScriptsVersionErrorc           B   s   e  Z d  Z RS(   s®   Errors specific to the parsing of a full .scripts-version file
    (errors that could also be triggered while parsing a parallel-find
    output should not be this subclass.)(   R$   R%   R&   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR9   ‡   s   R   c           B   s   e  Z d  „  Z RS(   c         C   s   d S(   NsO   

ERROR: Could not parse .scripts-version file.  It
contained too many fields.
(    (   R   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyt   __str__Ž   s    (   R$   R%   R:   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR      s   R   c           B   s   e  Z d  „  Z RS(   c         C   s   d S(   NsQ   

ERROR: Could not parse .scripts-version file. It
didn't contain enough fields.
(    (   R   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR:   –   s    (   R$   R%   R:   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   •   s   R   c           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  d  S(   N(   R
   (   R   R
   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR   ž   s    c         C   s   d |  i  S(   Ns   

ERROR: File %s didn't exist.
(   R
   (   R   (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR:       s    (   R$   R%   R   R:   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyR      s   	(   t   os.pathR-   t   dateutil.parserR   R   t   wizard.deployR   R    t   objectR   R   R3   R2   R1   R5   R   R9   R   R   R   (    (    (    s8   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/log.pyt   <module>   s   8