def _find_latest_version(self, releases, tag_name, spec_v): for release in releases: if 'tag_name' in release: pattern = tag_name.replace('%V', '(?P<v>.*?)') + '$' match = re.search(pattern, release.get('tag_name')) if match: prerelease = release.get('prerelease', False) if not prerelease: version = match.group('v') if util.check_package_version(version, spec_v): return version
def _get_valid_version(self, rel_name, organization, tag_name): # Download latest releases list releases = api_request('{}/releases'.format(rel_name), organization) if self.version: # Find required version via @ if not util.check_package_version(self.version, self.spec_version): util.show_package_version_warning( self.package, self.version, self.spec_version) exit(1) return self._find_required_version( releases, tag_name, self.version, self.spec_version) else: # Find latest version release return self._find_latest_version( releases, tag_name, self.spec_version)
def _get_valid_version(self, rel_name, organization, tag_name): # Download latest releases list releases = api_request('{}/releases'.format(rel_name), organization) if self.version: # Find required version via @ if not util.check_package_version(self.version, self.spec_version): util.show_package_version_warning(self.package, self.version, self.spec_version) exit(1) return self._find_required_version(releases, tag_name, self.version, self.spec_version) else: # Find latest version release return self._find_latest_version(releases, tag_name, self.spec_version)