OwlCyberSecurity - MANAGER
Edit File: version.cpython-38.pyc
U �h�h� � @ s� d Z ddlZddlmZ ddlmZ ddlmZm Z m Z ddlmZm Z ddlmZ ddlmZ d Zd Zed�dd �Zee d�dd�Zee d�dd�ZdS )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)�subpz37.1z37.1ubuntu0~20.04)�returnc C sv t �d�st S tj�tj�t��} tj�tj�| d��rrdddddg}zt|�\}}|� � W S t k rp Y nX 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.gitZgitZdescribez --abbrev=8z--match=[0-9]*z--long)�PACKAGED_VERSION� startswith�os�path�dirname�__file__�exists�joinr �stripr �__VERSION__)Ztopdir�cmd�out�_� r �2/usr/lib/python3/dist-packages/uaclient/version.py�get_version s r c C s� t � pt} tj�t�r&t�t�j| k r�d }zDtd�}|rltj t dd� ttd��}|�|� W 5 Q R X |W S W n$ t k r� |d k r�| Y S Y nX z0ttd��}|�� �� W 5 Q R � W S Q R X W n t k r� Y nX d S )Nzubuntu-pro-clientT)�exist_ok�w�r)r r r r r r �stat�st_mtimer �makedirsr �open�write� Exception�readr )Zlast_apt_cache_updateZcandidate_version�fr r r �get_last_known_candidate/ s, �� $r'