
    ^h^                     |   % S r SSKrSSKrSSKrSSKrSSKrSSKJrJr  SSK	r	S r
 " S S5      rS r " S S	\5      r0 r\\\4   \S
'   0 r\\\\\4   4   \S'   S r  S"S jrS r\" SS5      S 5       r\" SS5      S 5       r\" SS5      \4S j5       rS rS rS rS rS rS rS rS r S r!S r"S  r#S! r$g)#z"Git implementation of _version.py.    N)CallableDictc                      Sn SnSnXUS.nU$ )z;Get the keywords needed to look up the version information.z$Format:%d$z$Format:%H$z$Format:%ci$)refnamesfulldate )git_refnamesgit_fullgit_datekeywordss       J/home/james-whalen/.local/lib/python3.13/site-packages/pyccolo/_version.pyget_keywordsr      s"     !LHH(HMHO    c                       \ rS rSrSrSrg)VersioneerConfig#   z2Container for Versioneer configuration parameters.r	   N__name__
__module____qualname____firstlineno____doc____static_attributes__r	   r   r   r   r   #   s    <r   r   c                  n    [        5       n SU l        SU l        SU l        SU l        SU l        SU l        U $ )z:Create, populate and return the VersioneerConfig() object.gitpep440 zpyccolo-zpyccolo/_version.pyF)r   VCSstyle
tag_prefixparentdir_prefixversionfile_sourceverbose)cfgs    r   
get_configr&   '   s=     
CCGCICN%C2CCKJr   c                       \ rS rSrSrSrg)NotThisMethod5   zCException raised if a method is not valid for the current scenario.r	   Nr   r	   r   r   r(   r(   5   s    Mr   r(   LONG_VERSION_PYHANDLERSc                    ^ ^ UU 4S jnU$ )z:Create decorator to mark a method as the handler of a VCS.c                 F   > T[         ;  a	  0 [         T'   U [         T   T'   U $ )z!Store f in HANDLERS[vcs][method].)r+   )fmethodvcss    r   decorate&register_vcs_handler.<locals>.decorate?   s'    hHSM !fr   r	   )r0   r/   r1   s   `` r   register_vcs_handlerr3   =   s     Or   c           	         [        U [        5      (       d   eSn0 n[        R                  S:X  a<  [        R
                  " 5       nU=R                  [        R                  -  sl        XS'   U  HW  n	 [        U	/U-   5      n
[        R                  " U	/U-   4X%[        R                  U(       a  [        R                  OSS.UD6n  O   U(       a  [        SU < 35        gUR!                  5       S	   R#                  5       R%                  5       nUR&                  S	:w  a1  U(       a  [        S
U
-  5        [        SU-  5        SUR&                  4$ XR&                  4$ ! [         a^    [        R                  " 5       S   nUR                  [        R                  :X  a   GM3  U(       a  [        SW
-  5        [        U5           gf = f)zCall the given command(s).Nwin32startupinfo)cwdenvstdoutstderr   zunable to run %s)NNzunable to find command, tried r   zunable to run %s (error)zstdout was %s)
isinstancelistsysplatform
subprocessSTARTUPINFOdwFlagsSTARTF_USESHOWWINDOWstrPopenPIPEOSErrorexc_infoerrnoENOENTprintcommunicatestripdecode
returncode)commandsargsr7   r$   hide_stderrr8   processpopen_kwargsr6   commanddispcmder9   s                r   run_commandrX   H   s    h%%%%GL
||w ,,.z>>>&1]#	7)d*+G &&y4'7 KS.8ooBMz48K >JKG  $ BC  "1%++-446FQ,w67/F*+W''''%%%%%  	q!Aww%,,&(723a	s   2AEA G! GGc           
         / n[        S5       GH-  nU S4 H  nUR                  SS5      n[        R                  R	                  U5      /[        R
                  " U5      -    H  nUR                  SS5      nUR                  U5      (       d  M-  U[        U5      S R                  S5      nU Vs/ s H  n[        S U 5       5      (       d  M  UPM      nn[        U5      S::  a  M  SR                  U5      SS	SSS
.s  s  s  $    M     UR                  U5        [        R                  R                  U5      nGM0     U(       a  [        S[        U5      < SU < 35        [        S5      es  snf )a  Try to determine the version from the parent directory name.

Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an appropriately named parent directory
   r   -_N.c              3   @   #    U  H  oR                  5       v   M     g 7f)N)isdigit).0cs     r   	<genexpr>*versions_from_parentdir.<locals>.<genexpr>   s     5199;;s   r;   Fversionzfull-revisioniddirtyerrorr   zTried directories z but none started with prefix z+rootdir doesn't start with parentdir_prefix)rangereplaceospathbasenamelistdir
startswithlensplitalljoinappenddirnamerK   rD   r(   )	r"   rootr$   rootdirsr\   prefixrt   
componentscomps	            r   versions_from_parentdirrz   s   sM    H1X',F^^C-FGG,,T23bjj6FF!//#s3))&11$S[\288=
%/%/T555 Z   z?a'#&88J#7+/!&tE E G -  	wwt$% ( 8}.0 	1
E
FFs   0E.
E.
r   r   c                    0 n [        U S5       nU GH
  nUR                  5       R                  S5      (       a2  [        R                  " SU5      nU(       a  UR                  S5      US'   UR                  5       R                  S5      (       a2  [        R                  " SU5      nU(       a  UR                  S5      US'   UR                  5       R                  S5      (       d  M  [        R                  " SU5      nU(       d  M  UR                  S5      US	'   GM     S
S
S
5        U$ ! , (       d  f       U$ = f! [         a     U$ f = f)z0Extract version information from the given file.rzgit_refnames =z
=\s*"(.*)"r;   r   z
git_full =r   z
git_date =r   N)openrM   rn   researchgrouprG   )versionfile_absr   fobjlinemos        r   git_get_keywordsr      s    H/3'4::<**+;<<=$7B/1xx{,::<**<88=$7B+-88A;(::<**<88=$7Br+-88A;(  (  O! ('  O  Os;   D> CD,)D,	D,"D> ,
D;6D> ;D> >
EEr   c                    SU ;  a  [        S5      eU R                  S5      nUbE  UR                  5       S   nUR                  5       R	                  SSS5      R	                  SS	S5      nU S   R                  5       nUR                  S
5      (       a  U(       a  [        S5        [        S5      eUR                  S5      R                  S5       Vs1 s H  oUR                  5       iM     nnSnU Vs1 s H(  oUR                  U5      (       d  M  U[        U5      S iM*     nnU(       dV  U Vs1 s H#  n[        R                  " SU5      (       d  M!  UiM%     nnU(       a  [        SSR                  Xh-
  5      -  5        U(       a&  [        SSR                  [        U5      5      -  5        [        U5       Hu  n	U	R                  U5      (       d  M  U	[        U5      S n[        R                  " SU5      (       d  MG  U(       a  [        SU-  5        UU S   R                  5       SSUS.s  $    U(       a  [        S5        SU S   R                  5       SSSS.$ s  snf s  snf s  snf )z*Get version information from git keywords.r   zShort version file foundr   N Tr;   r   z$Formatz"keywords are unexpanded, not usingz.unexpanded keywords, not a git-archive tarballz(),ztag: z\dzdiscarding '%s', no digitszlikely tags: %sz
picking %sr   Frd   z2no suitable tags, using unknown + full revision id	0+unknownzno suitable tags)r(   get
splitlinesrM   ri   rn   rK   rp   ro   r~   r   rr   sortedmatch)
r   r!   r$   r   r   r|   refsTAGtagsrefs
             r   git_versions_from_keywordsr      s%    !677<<D  $ zz|##Ca088b!D
#))+H9%%67LMM'~~d399#>?>!GGI>D? C"&<$Q,,s*;LAc#hiL$D<  74a299UA#647.$+1FFG#((6$<"889d|>>*%%C
O$%A 88E1%%lQ&' '/'7'='='?"T " "   BC"'/557%7G GI @ = 8s   I4I#I#0 I(I(pieces_from_vcsc                 |   S/n[         R                  S:X  a  SS/n[        R                  R	                  5       nUR                  SS5        [        R                  " X5S9nU" USS	/US
S9u  pgUS:w  a   U(       a  [        SU-  5        [        S5      eU (       a  SSU -  /O/ nU" USSSSS/UQUS9u  pU	c  [        S5      eU	R                  5       n	U" USS/US9u  pU
c  [        S5      eU
R                  5       n
0 nXS'   U
SS US'   SUS'   U" U/ SQUS9u  pUS:w  d  Uc  [        S5      eUR                  5       nUS:X  aw  U" US S!/US9u  pUS:w  d  Uc  [        S"5      eUR                  S#5      nS$US   ;   a  UR                  S5        U Vs/ s H  oS%S PM	     nnS&U;   a  S&nOU(       d  SnOUS   nXS '   U	nUR                  S'5      nUUS('   U(       a  USUR                  S'5       nS)U;   a  [        R                  " S*U5      nU(       d
  S+U	-  US'   U$ UR!                  S,5      nUR#                  U 5      (       d)  U(       a  S-n[        UUU 4-  5        S.U< S/U < S03US'   U$ U[%        U 5      S US1'   ['        UR!                  S%5      5      US2'   UR!                  S35      US'   O SUS1'   U" U/ S4QUS9u  nn['        U5      US2'   U" U/ S5QUS9S   R                  5       nUR)                  5       S6   nUR                  5       R+                  S7S8S,5      R+                  S7S9S,5      US:'   U$ s  snf );a  Get version from 'git describe' in the root of the source tree.

This only gets called if the git-archive 'subst' keywords were *not*
expanded, and _version.py hasn't already been rewritten with a short
version string, meaning we're inside a checked out source tree.
r   r5   zgit.cmdzgit.exeGIT_DIRN)r8   	rev-parsez	--git-dirT)r7   rR   r   z"Directory %s not under git controlz('git rev-parse --git-dir' returned errorz--matchz%s*describez--tagsz--dirtyz--alwaysz--long)r7   z'git describe' failedHEADz'git rev-parse' failedlong   shortrg   )r   z--abbrev-refr   z+'git rev-parse --abbrev-ref' returned errorbranchz
--containsz&'git branch --contains' returned error
(   master-dirtyrf   r[   z^(.+)-(\d+)-g([0-9a-f]+)$z)unable to parse git-describe output: '%s'r;   z'tag '%s' doesn't start with prefix '%s'ztag 'z' doesn't start with prefix ''closest-tagdistancerZ   )zrev-listr   z--count)showz-sz--format=%cir   r   r   r   r   r   )r>   r?   rj   environcopypop	functoolspartialrK   r(   rM   rp   endswithrindexr~   r   r   rn   ro   intr   ri   )r!   ru   r$   runnerGITSr8   r\   rc
MATCH_ARGSdescribe_outfull_outpiecesbranch_namebranchesr   git_describerf   r   full_tagfmt	count_outr   s                         r   git_pieces_from_vcsr      s    7D
||w9%
 **//
CGGItv/F4+{3#%EA	Qw6=>FGG4>)UZ/0BJ dZ9%/%H<F%H"&(L 344%%'L$f 54@LH455~~HF6NrlF7OF7OT#H!%'OK 
Qw+%IJJ##%Kf dX|$<$G7h& HII>>$' (1+LLO .66X612JX6x"KK #1+K"8  L !!(+EF7O#$B\%8%8%BC lYY3\BJ!- .F7OM 88A;"":..?cXz223"*J 8F7OM (Z)9 :} !!-z ((1+w !%}t%D$O	2 ^z $>DI!LRRTD ??R DZZ\))#sA6>>sBJF6NM} 7s   L9c                 2    SU R                  SS5      ;   a  gg)z8Return a + if we don't already have one, else return a .+r   r   r]   )r   )r   s    r   plus_or_dotr   x  s    
fjj++r   c                     U S   (       aH  U S   nU S   (       d
  U S   (       a-  U[        U 5      -  nUSU S   U S   4-  -  nU S   (       a  US-  nU$ SU S   U S   4-  nU S   (       a  US-  nU$ )a  Build up version string, with post-release "local version identifier".

Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty

Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
r   r   rf   %d.g%sr   .dirtyz0+untagged.%d.g%sr   r   rendereds     r   render_pep440r     s     m-(*F++HF:$6w#HHHHgH$ O	 '&*<*0/*; ;'? HOr   c                 $   U S   (       aV  U S   nU S   (       d
  U S   (       a;  U S   S:w  a  US-  nU[        U 5      -  nUSU S   U S   4-  -  nU S   (       a  US	-  nU$ S
nU S   S:w  a  US-  nUSU S   U S   4-  -  nU S   (       a  US	-  nU$ )zTAG[[.dev0]+DISTANCE.gHEX[.dirty]] .

The ".dev0" means not master branch. Note that .dev0 sorts backwards
(a feature branch will appear "older" than the master branch).

Exceptions:
1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]
r   r   rf   r   r   .dev0r   r   r   0z+untagged.%d.g%sr   r   s     r   render_pep440_branchr     s     m-(*h8+G#F++HF:$6w#HHHHgH$ O (x'H&&*<*0/*; ; 	;'? HOr   c                     [         R                  U S5      nUS   [        U5      S:X  a  [        US   =(       d    S5      4$ S4$ )zSplit pep440 version string at the post-release segment.

Returns the release segments before the post-release and the
post-release version number (or -1 if no post-release segment is present).
z.postr   r   r;   N)rD   rp   ro   r   )vervcs     r   pep440_split_postr     sA     
3	 Ba5SW\#bejq/;;t;;r   c                     U S   (       aG  U S   (       a5  [        U S   5      u  pUnUb  USUS-   U S   4-  -  nU$ USU S   -  -  n U$ U S   n U$ SU S   -  nU$ )zSTAG[.postN.devDISTANCE] -- No -dirty.

Exceptions:
1: no tags. 0.post0.devDISTANCE
r   r   z.post%d.dev%dr;   z.post0.dev%dz0.post0.dev%d)r   )r   tag_versionpost_versionr   s       r   render_pep440_prer     s     m*(9&:O(P%K"H'O|A~vj?Q.RRR O NfZ.@AA O	 m,H O #VJ%77Or   c                     U S   (       aN  U S   nU S   (       d
  U S   (       a3  USU S   -  -  nU S   (       a  US-  nU[        U 5      -  nUSU S   -  -  nU$ SU S   -  nU S   (       a  US-  nUS	U S   -  -  nU$ )
a  TAG[.postDISTANCE[.dev0]+gHEX] .

The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
but you shouldn't be releasing software with -dirty anyways.

Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
r   r   rf   .post%dr   g%sr   0.post%d+g%sr   r   s     r   render_pep440_postr     s     m-(*	F:$666HgG#F++Hw//H O	 z 22'?HFVG_,,Or   c                 2   U S   (       a\  U S   nU S   (       d
  U S   (       aA  USU S   -  -  nU S   S:w  a  US-  nU[        U 5      -  nUSU S	   -  -  nU S   (       a  US
-  nU$ SU S   -  nU S   S:w  a  US-  nUSU S	   -  -  nU S   (       a  US
-  nU$ )zTAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .

The ".dev0" means not master branch.

Exceptions:
1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]
r   r   rf   r   r   r   r   r   r   r   r   r   r   r   s     r   render_pep440_post_branchr     s     m-(*	F:$666Hh8+G#F++Hw//HgH$ O z 22(x'HFVG_,,'? HOr   c                     U S   (       a5  U S   nU S   (       d
  U S   (       a  USU S   -  -  nU S   (       a  US-  nU$ SU S   -  nU S   (       a  US-  nU$ )zeTAG[.postDISTANCE[.dev0]] .

The ".dev0" means dirty.

Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
r   r   rf   r   r   r   r	   r   s     r   render_pep440_oldr     sw     m-(*	F:$666HgG# O z 22'?HOr   c                     U S   (       a   U S   nU S   (       a  USU S   U S   4-  -  nOU S   nU S   (       a  US-  nU$ )zTAG[-DISTANCE-gHEX][-dirty].

Like 'git describe --tags --dirty --always'.

Exceptions:
1: no tags. HEX[-dirty]  (note: no 'g' prefix)
r   r   -%d-g%sr   rf   r   r	   r   s     r   render_git_describer   &  s]     m-(*	VJ%7$IIIH '?gHOr   c                 n    U S   (       a  U S   nUSU S   U S   4-  -  nOU S   nU S   (       a  US-  nU$ )zTAG-DISTANCE-gHEX[-dirty].

Like 'git describe --tags --dirty --always -long'.
The distance/hash is unconditional.

Exceptions:
1: no tags. HEX[-dirty]  (note: no 'g' prefix)
r   r   r   r   rf   r   r	   r   s     r   render_git_describe_longr   :  sT     m-(I
!3VG_ EEE '?gHOr   c                    U S   (       a  SU R                  S5      SU S   SS.$ U(       a  US:X  a  SnUS:X  a  [        U 5      nOUS:X  a  [        U 5      nOzUS	:X  a  [        U 5      nOhUS
:X  a  [	        U 5      nOVUS:X  a  [        U 5      nODUS:X  a  [        U 5      nO2US:X  a  [        U 5      nO US:X  a  [        U 5      nO[        SU-  5      eX S   U S   SU R                  S5      S.$ )z9Render the given version pieces into the requested style.rg   unknownr   Nrd   defaultr   zpep440-branchz
pep440-prezpep440-postzpep440-post-branchz
pep440-oldzgit-describezgit-describe-longzunknown style '%s'rf   r   )
r   r   r   r   r   r   r   r   r   
ValueError)r   r    r   s      r   renderr   N  s	   g$#)::f#5	 	 EY& (	/	!'/	,	$V,	-	%f-	&	&,V4	,	$V,	.	 &v.	%	%+F3-5666NG_tJJv&( (r   c                     [        5       n U R                  n [        [        5       U R                  U5      $ ! [
         a     Of = f [        R                  R                  [        5      nU R                  R                  S5       H"  n[        R                  R                  U5      nM$     O! [         a    SSSSSS.s $ f = f [        U R                  X!5      n[        X@R                   5      $ ! [
         a     Of = f U R"                  (       a  [%        U R"                  X!5      $ O! [
         a     Of = fSSSSSS.$ )z=Get version information or return default if unable to do so./r   Nz"unable to find root of source treerd   zunable to compute version)r&   r$   r   r   r!   r(   rj   rk   realpath__file__r#   rp   rt   	NameErrorr   r   r    r"   rz   )r%   r$   ru   r\   r   s        r   get_versionsr   r  s=    ,CkkG),.#..*13 	3 ww) ''--c2A77??4(D 3 &4= 	$S^^TCfii(( *3+?+?OO    #t0$@ @sF   7 
AAA$B- -CC*C1 1
C>=C>&D* *
D76D7)NFFN)%r   rI   rj   r~   r@   r>   typingr   r   r   r   r   r&   	Exceptionr(   r*   rD   __annotations__r+   r3   rX   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r	   r   r   <module>r      s'   )  	 	  
 ! 
= =NI N #%c3h $+-$sDh''
( - FK(&V GF e^, -6 eZ(<G )<G~ e./:E B 0BJ2<<06:,((!(H+@r   