Hcf dZddlZddlmZddlmZddlmZm Z m Z ddl m Z m Z ddlmZddlmZd Zd Zd efd Zd eefd Zd eefdZy)z" Client version related functions N)inf)Optional)get_apt_cache_timeget_pkg_candidate_versionversion_compare)CANDIDATE_CACHE_PATH UAC_RUN_PATH)ProcessExecutionError)subpz32.3.1z 32.3.1~24.04returnctjdstStjj tjj t }tjj tjj|dr#gd} t|\}}|jStS#t$rYtSwxYw)aOReturn 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)gitdescribez --abbrev=8z--match=[0-9]*z--long) PACKAGED_VERSION startswithospathdirname__file__existsjoinr stripr __VERSION__)topdircmdout_s 2/usr/lib/python3/dist-packages/uaclient/version.py get_versionrs  & &'; < WW__RWW__X6 7F ww~~bggll6623K #YFC99;  %    sC CCcTtxst}tjj t r&tj t j|krXd} td}|rGtjtdtt d5}|j|ddd|S tt d5}|jjcdddS#1swY|SxYw#t$r ||cYSYWwxYw#1swYyxYw#t$rYywxYw)Nzubuntu-pro-clientT)exist_okwr)rrrrrrstatst_mtimermakedirsr openwrite Exceptionreadr)last_apt_cache_updatecandidate_versionfs rget_last_known_candidater./s/07C GGNN/ 0 77' ( 1 14I I  ) 9:M N   L48.4/GG-./(( ! & , $668>># $ $/(( ) ,((- )  $     s`8C:C-) C:5DD# D-C72C:7C:: D  D DDD D'&D'cNt}|rt|tdkDr|Sy)Nr)r.rr) candidates rcheck_for_new_versionr1Ls&(*I_Y >B )__doc__os.pathrmathrtypingr uaclient.aptrrruaclient.defaultsrr uaclient.exceptionsr uaclient.systemr rrstrrr.r1r2rr=sb A5  !S2(3-:x}r2