Created
January 16, 2011 22:51
-
-
Save elmarx/782231 to your computer and use it in GitHub Desktop.
Fetches the most recent intellij idea x version if not yet installed, to use in daily anacron job or simliar. Very basic functionality, very specific to my setup. But should be easy to adopt.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import re | |
from urllib import request | |
import os | |
WEBSITE = "http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP" | |
MATCH = r".*(http://download\.jetbrains\.com/idea/ideaIU-(\d+\.\d+)\.tar\.gz).*" | |
with request.urlopen(WEBSITE) as h: | |
for line in [x.decode() for x in h.readlines()]: | |
m = re.match(MATCH, line) | |
if m: | |
url = m.groups()[0] | |
version = m.groups()[1] | |
if not os.path.exists('/opt/idea-IU-%s' % version): | |
print('Idea will be upgraded to version %s:' % version) | |
os.system('wget -qO - %s | sudo tar xzf - -C /opt' % url) | |
os.system('sudo rm /opt/idea') | |
os.system('sudo ln -s /opt/idea-IU-%s /opt/idea' % version) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment