o
    =Wb                     @   s:   d Z ddlZddlmZmZ dZdZdZdi fddZ	dS )	z
Version determination functions

These are in their own file so they can be imported by setup.py before we have
any of our dependencies installed.
    N)
exceptionsutilz27.8z27.8~22.04.1z{version}{feature_suffix}c           	      C   s   d}t | D ]\}}|dj|rdnd|d7 }qtds&tjt|dS tjtjt	}tj
tj|drlg d	}zt|\}}| | W S  tjyk   g d
}t|\}}tj| |d Y S w tjt|dS )a$  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,
              parse the debian/changelog in that case
     z {enabled}{name}+-)enablednamez@@PACKAGED_VERSION)versionfeature_suffixz.git)ZgitZdescribez
--abbrev=8z--match=[0-9]*z--long)zdpkg-parsechangelogz-Sr	   )sorteditemsformatPACKAGED_VERSION
startswithVERSION_TMPLospathdirname__file__existsjoinr   Zsubpstripr   ZProcessExecutionError__VERSION__)	Z_argsZfeaturesr
   keyvalueZtopdircmdout_ r   2/usr/lib/python3/dist-packages/uaclient/version.pyget_version   s2   


r    )
__doc__os.pathr   Zuaclientr   r   r   r   r   r    r   r   r   r   <module>   s    