Skip to content

Commit

Permalink
Guess unmarked prereleases based on the version string
Browse files Browse the repository at this point in the history
See the discussion on the user page for more details on why this is necessary
  • Loading branch information
konstin committed Apr 12, 2017
1 parent 5dacdb9 commit da84b0e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

class Settings:
do_update_wikidata = True
# Don't activate this, it's most likely broken
do_update_wikipedia = False

sparql_file = "free_software_items.rq"
Expand Down Expand Up @@ -232,20 +233,27 @@ def get_data_from_github(url, properties):
release_name = normalize_version(release["name"], project_info["name"])
release_tag_name = normalize_version(release["tag_name"], project_info["name"])

# Workaround for Activiti
if "Beta" in release_name or "Beta" in release_tag_name:
release["prerelease"] = True

match_name = re.search(Settings.version_regex, release_name)
match_tag_name = re.search(Settings.version_regex, release_tag_name)
if match_name:
version = match_name.group(0)
original_version = release_name
elif match_tag_name:
version = match_tag_name.group(0)
original_version = release_tag_name
else:
print(" - Invalid version strings '{}'".format(release["name"]))
continue

if not release["prerelease"]:
print("{} ({})".format(version, original_version))

# Fix missing "Release Camdiate" annotation on github
if not release["prerelease"] and re.search(r"[ -._\d](r|rc|beta|alpha)([ .\d].*)?$", original_version, re.IGNORECASE):
print("Assuming Release Candidate: ", original_version)
release["prerelease"] = True
continue

# Convert github's timestamps to wikidata dates
date = pywikibot.WbTime.fromTimestr(release["published_at"], calendarmodel=Settings.calendarmodel)
date.hour = 0
Expand Down

0 comments on commit da84b0e

Please sign in to comment.