Windows reinstallation option (handy for upgrades).
This commit is contained in:
parent
b9f7854f7c
commit
cc51dbe3b0
|
@ -10,7 +10,7 @@ from _winreg import OpenKey, CloseKey, QueryValueEx, SetValueEx, \
|
|||
HKEY_CURRENT_USER, KEY_ALL_ACCESS, REG_EXPAND_SZ
|
||||
import ctypes
|
||||
from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, LPVOID
|
||||
|
||||
import shutil
|
||||
|
||||
VENV_URL = 'https://pypi.python.org/pypi/virtualenv/json'
|
||||
APPDATA = os.environ['LocalAppData']
|
||||
|
@ -22,8 +22,13 @@ LRESULT = LPARAM
|
|||
HWND_BROADCAST = 0xFFFF
|
||||
WM_SETTINGCHANGE = 0x1A
|
||||
|
||||
def find_location():
|
||||
|
||||
def get_location():
|
||||
install_dir = os.path.join(APPDATA, APP)
|
||||
return install_dir
|
||||
|
||||
def find_location():
|
||||
install_dir = get_location()
|
||||
if os.path.exists(install_dir) and os.path.isdir(install_dir):
|
||||
return None, None
|
||||
return install_dir, os.path.join(install_dir, LIB)
|
||||
|
@ -86,7 +91,20 @@ def main():
|
|||
|
||||
install_dir, lib_dir = find_location()
|
||||
if install_dir == None:
|
||||
fail('Lektor seems to be installed already.')
|
||||
print 'Lektor seems to be already installed'
|
||||
while 1:
|
||||
input = raw_input(
|
||||
'Delete existing and reinstall? [Yn]'
|
||||
).lower().strip()
|
||||
|
||||
if input in ('', 'y'):
|
||||
break
|
||||
elif input in 'n':
|
||||
print 'Aborted!'
|
||||
sys.exit()
|
||||
|
||||
shutil.rmtree(get_location())
|
||||
|
||||
|
||||
print ' Installing at: %s' % install_dir
|
||||
while 1:
|
||||
|
|
Loading…
Reference in New Issue