Ë
    ‚­Kj‹
  ã                   óœ   — d Z ddlZddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlmZmZ ddlmZ ddlmZ d	Zd
Zdefd„Zdee   fd„Zdee   fd„Zy)z"
Client version related functions
é    N)Úinf)ÚOptional)Úget_apt_cache_timeÚget_pkg_candidate_versionÚversion_compare)ÚCANDIDATE_CACHE_PATHÚUAC_RUN_PATH)ÚProcessExecutionError)Úsubpz37.2z37.2ubuntu~24.04.1Úreturnc                  ó¬  — t         j                  d«      st         S t        j                  j	                  t        j                  j	                  t
        «      «      } t        j                  j                  t        j                  j                  | d«      «      r#g d¢}	 t        |«      \  }}|j                  «       S t        S # t        $ r Y t        S w xY w)aO  Return the packaged version as a string

    Prefer the binary PACKAGED_VESION set by debian/rules to DEB_VERSION.
    If unavailable, check for a .git development environments:
      a. If run in our upstream repo `git describe` will gives a leading
         XX.Y so return the --long version to allow daily build recipes
         to count commit offset from upstream's XX.Y signed tag.
      b. If run in a git-ubuntu pkg repo, upstream tags aren't visible,
         believe __VERSION__ is correct - there is and MUST always be a
         test to make sure it matches debian/changelog
    z@@PACKAGED_VERSIONz.git)ÚgitÚdescribez
--abbrev=8z--match=[0-9]*z--long)ÚPACKAGED_VERSIONÚ
startswithÚosÚpathÚdirnameÚ__file__ÚexistsÚjoinr   Ústripr
   Ú__VERSION__)ÚtopdirÚcmdÚoutÚ_s       ú2/usr/lib/python3/dist-packages/uaclient/version.pyÚget_versionr      sœ   € ô ×&Ñ&Ð';Ô<ÜÐÜ�W‰W�_‰_œRŸW™WŸ_™_¬XÓ6Ó7€FÜ	‡w�w‡~�~”b—g‘g—l‘l 6¨6Ó2Ô3ÚKˆð	Ü˜#“Y‰FˆC�Ø—9‘9“;Ðô Ðøô %ò 	ØÜÐð	ús   ÂC Ã	CÃCc                  óT  — t        «       xs t        } t        j                  j	                  t
        «      r&t        j                  t
        «      j                  | k  rXd }	 t        d«      }|rGt        j                  t        d¬«       t        t
        d«      5 }|j                  |«       d d d «       |S 	 	 t        t
        d«      5 }|j                  «       j                  «       cd d d «       S # 1 sw Y   |S xY w# t        $ r	 |�|cY S Y ŒWw xY w# 1 sw Y   y xY w# t        $ r Y y w xY w)Nzubuntu-pro-clientT)Úexist_okÚwÚr)r   r   r   r   r   r   ÚstatÚst_mtimer   Úmakedirsr	   ÚopenÚwriteÚ	ExceptionÚreadr   )Úlast_apt_cache_updateÚcandidate_versionÚfs      r   Úget_last_known_candidater.   /   s  € ô /Ó0Ò7´CÐä�G‰G�N‰NÔ/Ô0Ü�7‰7Ô'Ó(×1Ñ1Ð4IÒIà Ðð		)Ü 9Ð:MÓ NÐÙ Ü—‘œL°4Õ8ÜÔ.°Ó4ð /¸Ø—G‘GÐ-Ô.÷/à(Ð(ð	 !ðÜÔ&¨Ó,ð 	$°Ø—6‘6“8—>‘>Ó#÷	$ñ 	$÷/à(Ð(ûÜò 	)Ø Ð,Ø(Ò(ñ -ð	)ú÷
	$ð
 ûô ò Øàðús`   Á8C: ÂC-Â)	C: Â5D ÃDÃ#	D Ã-C7Ã2C: Ã7C: Ã:DÄDÄDÄD ÄD Ä	D'Ä&D'c                  óN   — t        «       } | rt        | t        «       «      dkD  r| S y )Nr   )r.   r   r   )Ú	candidates    r   Úcheck_for_new_versionr1   L   s&   € Ü(Ó*€IÙ”_ Y´³Ó>ÀÒBØÐØó    )Ú__doc__Úos.pathr   Úmathr   Útypingr   Úuaclient.aptr   r   r   Úuaclient.defaultsr   r	   Úuaclient.exceptionsr
   Úuaclient.systemr   r   r   Ústrr   r.   r1   © r2   r   ú<module>r=      sb   ðñó Ý Ý ÷ñ ÷
 AÝ 5Ý  à€Ø'Ð ð�Só ð2 (¨3¡-ó ð:˜x¨™}ô r2   