def github_tags_newer(github_repo, versions_file, update_majors): """ Update newer tags based on a github repository. @param github_repo: the github repository, e.g. 'drupal/drupal/'. @param versions_file: the file path where the versions database can be found. @param update_majors: major versions to update. If you want to update the 6.x and 7.x branch, you would supply a list which would look like ['6', '7'] @return: a boolean value indicating whether an update is needed """ github_repo = _github_normalize(github_repo) vf = VersionsFile(versions_file) current_highest = vf.highest_version_major(update_majors) tags_url = '%s%stags' % (GH, github_repo) resp = requests.get(tags_url) bs = BeautifulSoup(resp.text, 'lxml') gh_versions = [] for tag in bs.find_all('span', {'class':'tag-name'}): gh_versions.append(tag.text) newer = _newer_tags_get(current_highest, gh_versions) return len(newer) > 0
def github_tags_newer(github_repo, versions_file, update_majors): """ Get new tags from a github repository. Cannot use github API because it doesn't support chronological ordering of tags. @param github_repo: the github repository, e.g. 'drupal/drupal/'. @param versions_file: the file path where the versions database can be found. @param update_majors: major versions to update. If you want to update the 6.x and 7.x branch, you would supply a list which would look like ['6', '7'] @return: a boolean value indicating whether an update is needed @raise MissingMajorException: A new version from a newer major branch is exists, but will not be downloaded due to it not being in majors. """ github_repo = _github_normalize(github_repo) vf = VersionsFile(versions_file) current_highest = vf.highest_version_major(update_majors) tags_url = '%s%stags' % (GH, github_repo) resp = requests.get(tags_url) bs = BeautifulSoup(resp.text, 'lxml') gh_versions = [] for header in bs.find_all('h4'): tag = header.findChild('a') if not tag: continue # Ignore learn more header. gh_versions.append(tag.text.strip()) newer = _newer_tags_get(current_highest, gh_versions) return len(newer) > 0
def github_tags_newer(github_repo, versions_file, update_majors): """ Get new tags from a github repository. @param github_repo: the github repository, e.g. 'drupal/drupal/'. @param versions_file: the file path where the versions database can be found. @param update_majors: major versions to update. If you want to update the 6.x and 7.x branch, you would supply a list which would look like ['6', '7'] @return: a boolean value indicating whether an update is needed """ github_repo = _github_normalize(github_repo) vf = VersionsFile(versions_file) current_highest = vf.highest_version_major(update_majors) tags_url = '%s%stags' % (GH, github_repo) resp = requests.get(tags_url) bs = BeautifulSoup(resp.text, 'lxml') gh_versions = [] for tag in bs.find_all('span', {'class': 'tag-name'}): gh_versions.append(tag.text) newer = _newer_tags_get(current_highest, gh_versions) return len(newer) > 0