Wiping previous lektor installations

This commit is contained in:
Elias Zeitfogel 2015-12-23 18:54:17 +01:00
parent 0dd220a4db
commit 258c889679
1 changed files with 10 additions and 1 deletions

View File

@ -24,6 +24,7 @@ if 1:
import json import json
import urllib import urllib
import tempfile import tempfile
import shutil
from subprocess import Popen from subprocess import Popen
sys.stdin = open('/dev/tty', 'r') sys.stdin = open('/dev/tty', 'r')
@ -67,6 +68,14 @@ if 1:
t = tempfile.mkdtemp() t = tempfile.mkdtemp()
Popen('curl -sf "%s" | tar -xzf - --strip-components=1' % Popen('curl -sf "%s" | tar -xzf - --strip-components=1' %
virtualenv_url, shell=True, cwd=t).wait() virtualenv_url, shell=True, cwd=t).wait()
symlink_path = os.path.join(bin_dir, 'lektor')
if os.path.exists(symlink_path):
os.remove(symlink_path)
if os.path.exists(lib_dir):
shutil.rmtree(lib_dir, ignore_errors=True)
try: try:
os.makedirs(lib_dir) os.makedirs(lib_dir)
except OSError: except OSError:
@ -75,7 +84,7 @@ if 1:
Popen([os.path.join(lib_dir, 'bin', 'pip'), Popen([os.path.join(lib_dir, 'bin', 'pip'),
'install', '--upgrade', 'Lektor']).wait() 'install', '--upgrade', 'Lektor']).wait()
os.symlink(os.path.join(lib_dir, 'bin', 'lektor'), os.symlink(os.path.join(lib_dir, 'bin', 'lektor'),
os.path.join(bin_dir, 'lektor')) symlink_path)
def main(): def main():
print 'Welcome to Lektor' print 'Welcome to Lektor'