/usr/lib/python3/dist-packages/uaclient/__pycache__
Edit: /usr/lib/python3/dist-packages/uaclient/__pycache__/version.cpython-310.pyc (2499B)
o
SKj
@ s d Z ddlZddlmZ ddlmZ ddlmZm Z m
Z
ddlmZm
Z
ddlmZ ddlmZ d Zd
Zdefdd
Zdee fddZdee fddZdS )z"
Client version related functions
N)inf)Optional)get_apt_cache_timeget_pkg_candidate_versionversion_compare)CANDIDATE_CACHE_PATHUAC_RUN_PATH)ProcessExecutionError)subpz37.2z37.2ubuntu~22.04.1returnc C sp t dst S tjtjt} tjtj| dr6g d}zt|\}}| W S t
y5 Y tS w tS )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)gitdescribez
--abbrev=8z--match=[0-9]*z--long)PACKAGED_VERSION
startswithospathdirname__file__existsjoinr
stripr __VERSION__)topdircmdout_ r 2/usr/lib/python3/dist-packages/uaclient/version.pyget_version s
r c C s t pt} tjtrttj| k rUd }z.td}|rBtj t
dd ttd}|| W d |W S 1 s:w Y |W S W n t
yT |d urR| Y S Y nw zttd}| W d W S 1 smw Y W d S t
y~ Y d S w )Nzubuntu-pro-clientT)exist_okwr)r r r r r r statst_mtimer makedirsr openwrite Exceptionreadr )last_apt_cache_updatecandidate_versionfr r r get_last_known_candidate/ s<