3
 a                 @   s6   d Z ddlZddl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)utilz27.2z27.2.2~18.04.1z{version}{feature_suffix}c       	      C   s   d}x2t |j D ]"\}}|dj|r(dnd|d7 }qW tjdsPtjt|dS tjjtjjt	}tjj
tjj|drd	d
dddg}ytj|\}}|j | S  tjk
r   dddg}tj|\}}tj|j |dS X 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gitZdescribez
--abbrev=8z--match=[0-9]*z--longzdpkg-parsechangelogz-Sr   )sorteditemsformatPACKAGED_VERSION
startswithVERSION_TMPLospathdirname__file__existsjoinr   subpstripProcessExecutionError__VERSION__)	_argsfeaturesr	   keyvalueZtopdircmdout_ r"   2/usr/lib/python3/dist-packages/uaclient/version.pyget_version   s(    


r$   )	__doc__Zos.pathr   uaclientr   r   r   r   r$   r"   r"   r"   r#   <module>   s   