Skip to content

Instantly share code, notes, and snippets.

@syxolk
Created March 21, 2017 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syxolk/333c3d947ed40ca60d1570ebcad8db83 to your computer and use it in GitHub Desktop.
Save syxolk/333c3d947ed40ca60d1570ebcad8db83 to your computer and use it in GitHub Desktop.
Compare the latest release with the currently installed version of Atom
#!/usr/bin/env python3
import requests
import subprocess
def get_latest():
response = requests.get("https://github.com/atom/atom/releases/latest")
return response.url[response.url.rfind("/")+2:]
def get_current():
output = subprocess.check_output(["atom", "--version"])
for line in output.decode().splitlines():
if line.split(":")[0].strip() == "Atom":
return line.split(":")[1].strip()
return None
if __name__ == "__main__":
current = get_current()
print("Current version: {0}".format(current))
latest = get_latest()
print("Latest version: {0}".format(latest))
print()
if latest != current:
print("\033[31m-> Needs update!\033[30m")
else:
print("\033[32mYou are up to date\033[30m")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment