
    %
i                         d dl Z d dlZd dlZd dlZd dlZd dlZej        j        Zej        j	        
                    dd dd            d Zd Zd Zd Zdd
Zd Zd Zd ZddZedk    rdZ eedd           dS dS )    Nz&{783CD4E0-9D54-11CF-B8EE-00608CC9A71F}   c                      t           j                            d          } |                     t          j        t          j        t          j                   | S )N
SourceSafe)win32comclientDispatchOpen	pythoncomMissing)sss    C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\win32/scripts/VersionStamp/vssutil.pyGetSSr      s=    		!	!,	/	/B GGIy0)2CDDDI    c                     t                      }|                    |           }|                    t          j                  D ]'}t          |j        j        |j        |j                   (d S N)	r   VSSItemGetVersions	constantsVSSFLAG_RECURSYESprintNameVersionNumberAction)projectNamer   projectitems       r   testr      si    	Bjj%%G##I$?@@ B Bdl!3T[AAAAB Br   c                    d}|                      |          }g }t          t          |                    D ]}d}||         }|dz  dk    r`	 t          ||d         |d                   }|                    |           d}n*#  t          j                     t          d|           Y nxY w|s|                    |           d                    t          t          |                    S )N$r         zCould not substitute )splitrangelenevalappend	traceback	print_excr   joinmapstr)inStringevalEnv	substCharfields	newFieldsididSubststrVals           r   SubstituteInStringr5   "   s    I^^I&&FI3v;; % %q5A::6fgaj'!*==  (((6#%%%,f55555 	%V$$$773sI&&'''s   4B%B(c                 |   t          | d          }	 t          |d          }	 	 |                                }|sn$|                    t          ||                     ;	 |                                 n# |                                 w xY w	 |                                 d S # |                                 w xY w)Nrw)openreadwriter5   close)inNameoutNamer.   inFileoutFilelines         r   SubstituteInFilerB   6   s    &#Fw$$	A{{}} 0w??@@@	A  MMOOOOGMMOOOOOs"   B% <A5  B% 5BB% %B;r"      c                 R   g }d}d}|                      t          j                  D ]}|dz  }||k    r ndx}}	|j        d d         dk    r't	          |j                  r|dz  }|j        }	n(|j        j        }	t          |	dd                    dk    rp|j	        rd| d	|j	         }|
                    d
                    |t          j        t          j        t          |j                                      |	|                     ||k    r nd                    |          S )Nr   r!   r"   r   Addedz.dsp
	z	{}{}	{}{})r   r   r   r   r%   Labelr   r   r,   Commentr'   formattimeasctime	localtimeintDater*   )
r   
linePrefixnoLabelsmaxItemslinesnumlabelNumr2   commentDescitemDescs
             r   VssLogrY   F   sN   E
CH  !<==  q>>E!##h8BQB<7""qw<< 	MHxHHy~H8BCC=!!V++9 	98z88QY88KT^CKK8899	 	
 	
 	
 hE 99Ur   c                 X   dd l }|                    |          |                    |          k    rt          d          t                      }|                    |           }d }|j        D ]}|j        r nt          d           d S |j        }t          j	        t          j
        t          |j                                      }	t          j	        t          j
        t          j                                        }
t          ||t                      t                      f           d S )Nr   z2The input and output filenames can not be the samez0Couldn't find a label in the sourcesafe project!)win32apiGetFullPathNameRuntimeErrorr   r   VersionsrI   r   rL   rM   rN   rO   rP   rB   localsglobals)r   r=   r>   r[   
sourceSafer   labelversion	vss_labelvss_datenows              r   SubstituteVSSInFilerg   g   s   OOO''8+C+CG+L+LLLOPPPJ  --GE#  = 	E	 	@AAAI|DN3w|+<+<==>>H
,t~dikk22
3
3CVWvxx&;<<<<<r   c                     d}| j         t          j        k    r| j        D ]}|t	          |          z  }n| j        r|dz  }|S )Nr   r!   )Typer   VSSITEM_PROJECTItemsCountCheckoutsIsCheckedOut)r   rU   subs      r   rl   rl   }   s\    
CyI---: 	' 	'C>#&&&CC	'  	1HCJr   c                     t                                          |           }d }|j        D ]}t          |j                  }|r|c S d S r   )r   r   r^   r,   rI   )r   r2   labrc   s       r   GetLastBuildNorq      sW      A
C:  '-   	JJJ	4r   c                 p   |d}t                      }|                    |           }t          |          }|dk    r:d|z  }dd l}|                    || t
          j                  t
          j        k    rd S t          |           x}	}
|
d}
d}	nL	 t          |
          }
|s|
dz  }
t          |
          }
n%# t          $ r}t          d|	           |d }~ww xY w|s&ddlm} |                    d	|
|  d
|	           }
|
d S |                    |
d|
 d|            |rt!          d|  d|
            |
S )NzCreated by Pythonr   zGThis project has %d items checked out

Do you still want to continue?1z<None>r!   z-The previous label could not be incremented: )dialogzEnter new build numberz	 - Prev: zBuild z: zBranded project z with label )r   r   rl   win32ui
MessageBoxwin32conMB_YESNOIDYESrq   rO   r,   
ValueError	pywin.mfcrt   GetSimpleInputrI   r   )r   	buildDescautobRebrandr   r2   rU   msgru   oldBuildbuildNoerrorrt   s                r   MakeNewBuildNor      s   '		B


7A


C
QwwY 	 	c7H,=>>(.PPF'000Hw	'llG 1'llGG 	 	 	JJJ 	
  $$$$$$''$g'/N/NH/N/N
 
 ?FGGG4g4444555 A???g??@@@Ns   %B6 6
C CC__main__z\Python\Python Win32 Extensionszd:\src\pythonex\win32\win32.txtzd:\temp\win32.txt)r"   r   rC   )Nr   r   )rL   r(   r
   win32com.clientr   win32com.client.gencacherw   r   r   gencacheEnsureModuler   r   r5   rB   rY   rg   rl   rq   r   __name__tp r   r   <module>r      sN                    O%	   % %&NPQSTVW X X X  B B B( ( ((      B= = =,    * * * *Z z 
-B
13H     r   