update log messages for embedded python

This commit is contained in:
Alan Hamlett 2015-12-01 01:04:41 -08:00
parent 27afc41bf4
commit 284cdf3ce4
1 changed files with 7 additions and 4 deletions

View File

@ -391,12 +391,12 @@ class SendHeartbeatThread(threading.Thread):
} }
class InstallPython(threading.Thread): class DownloadPython(threading.Thread):
"""Non-blocking thread for installing Python on Windows machines. """Non-blocking thread for extracting embeddable Python on Windows machines.
""" """
def run(self): def run(self):
log(INFO, 'Downloading and installing python...') log(INFO, 'Downloading embeddable Python...')
ver = '3.5.0' ver = '3.5.0'
arch = 'amd64' if platform.architecture()[0] == '64bit' else 'win32' arch = 'amd64' if platform.architecture()[0] == '64bit' else 'win32'
@ -414,6 +414,7 @@ class InstallPython(threading.Thread):
except AttributeError: except AttributeError:
urllib.request.urlretrieve(url, zip_file) urllib.request.urlretrieve(url, zip_file)
log(INFO, 'Extracting Python...')
with ZipFile(zip_file) as zf: with ZipFile(zip_file) as zf:
path = os.path.join(os.path.expanduser('~'), '.wakatime', 'python') path = os.path.join(os.path.expanduser('~'), '.wakatime', 'python')
zf.extractall(path) zf.extractall(path)
@ -423,6 +424,8 @@ class InstallPython(threading.Thread):
except: except:
pass pass
log(INFO, 'Finished extracting Python.')
def plugin_loaded(): def plugin_loaded():
global SETTINGS global SETTINGS
@ -433,7 +436,7 @@ def plugin_loaded():
if not python_binary(): if not python_binary():
log(WARNING, 'Python binary not found.') log(WARNING, 'Python binary not found.')
if platform.system() == 'Windows': if platform.system() == 'Windows':
thread = InstallPython() thread = DownloadPython()
thread.start() thread.start()
else: else:
sublime.error_message("Unable to find Python binary!\nWakaTime needs Python to work correctly.\n\nGo to https://www.python.org/downloads") sublime.error_message("Unable to find Python binary!\nWakaTime needs Python to work correctly.\n\nGo to https://www.python.org/downloads")