#NEWLINE# def _get_version_from_pkg_resources( self ) : #NEWLINE# #INDENT# 'Obtain a version from pkg_resources or setup-time logic if missing.\n\n        This will try to get the version of the package from the pkg_resources\n        record associated with the package, and if there is no such record\n        falls back to the logic sdist would use.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# requirement = pkg_resources . Requirement . parse ( self . package ) #NEWLINE# provider = pkg_resources . get_provider ( requirement ) #NEWLINE# result_string = provider . version #NEWLINE# #UNINDENT# except pkg_resources . DistributionNotFound : #NEWLINE# #INDENT# from pbr import packaging #NEWLINE# result_string = packaging . get_version ( self . package ) #NEWLINE# #UNINDENT# return SemanticVersion . from_pip_string ( result_string )