HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //proc/93580/root/lib/python3/dist-packages/uaclient/__pycache__/version.cpython-310.pyc
o

�h�h�
�@s�dZddlZddlmZddlmZddlmZm	Z	m
Z
ddlmZm
Z
ddlmZddlmZd	Zd
Zdefdd
�Zdeefdd�Zdeefdd�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~22.04�returncCspt�d�stStj�tj�t��}tj�tj�|d��r6gd�}zt|�\}}|�	�WSt
y5YtSwtS)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)�git�describez
--abbrev=8z--match=[0-9]*z--long)�PACKAGED_VERSION�
startswith�os�path�dirname�__file__�exists�joinr
�stripr	�__VERSION__)�topdir�cmd�out�_�r�2/usr/lib/python3/dist-packages/uaclient/version.py�get_versions

�rcCs�t�pt}tj�t�rt�t�j|krUd}z.td�}|rBtj	t
dd�ttd��}|�|�Wd�|WS1s:wY|WSWnt
yT|durR|YSYnwzttd��}|����Wd�WS1smwYWdSt
y~YdSw)Nzubuntu-pro-clientT)�exist_ok�w�r)rrrrrr�stat�st_mtimer�makedirsr�open�write�	Exception�readr)�last_apt_cache_update�candidate_version�frrr�get_last_known_candidate/s<

�
�����
$���r,cCs"t�}|rt|t��dkr|SdS)Nr)r,rr)�	candidaterrr�check_for_new_versionLsr.)�__doc__�os.pathr�mathr�typingr�uaclient.aptrrr�uaclient.defaultsrr�uaclient.exceptionsr	�uaclient.systemr
rr�strrr,r.rrrr�<module>s