version.py 文件源码

python
阅读 103 收藏 0 点赞 0 评论 0

项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码
def _get_version_from_pkg_resources(self):
        """Obtain a version from pkg_resources or setup-time logic if missing.

        This will try to get the version of the package from the pkg_resources
        record associated with the package, and if there is no such record
        falls back to the logic sdist would use.
        """
        try:
            requirement = pkg_resources.Requirement.parse(self.package)
            provider = pkg_resources.get_provider(requirement)
            return provider.version
        except pkg_resources.DistributionNotFound:
            # The most likely cause for this is running tests in a tree
            # produced from a tarball where the package itself has not been
            # installed into anything. Revert to setup-time logic.
            from pbr import packaging
            return packaging.get_version(self.package)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号