def get_version(self):
"""extract version number from the b3.egg-info/PKG-INFO file"""
log.info(">>> parse B3 version")
pkginfo_file = os.path.join(self.build_exe, 'PKG-INFO')
pkginfo_version = re.compile(
r'^\s*Version:\s*(?P<version>(?P<numbers>\d+\.\d+(?:\.\d+)?)(?P<pre_release>(?:a|b|dev|d)\d*)?(?P<suffix>.*?))\s*$',
re.MULTILINE)
with open(pkginfo_file, 'r') as f:
match = pkginfo_version.search(f.read())
if not match:
log.error("could not find version from %s" % pkginfo_file)
sys.exit(1)
current_b3_version_part1 = match.group("numbers")
current_b3_version_part2 = ""
if match.group("pre_release"):
current_b3_version_part2 += match.group("pre_release")
if match.group("suffix"):
current_b3_version_part2 += match.group("suffix")
return current_b3_version_part1, current_b3_version_part2
评论列表
文章目录