ability to override python binary location

This commit is contained in:
Alan Hamlett 2017-11-05 20:04:48 -08:00
parent 7492c3ce12
commit 385ba818cc
2 changed files with 10 additions and 3 deletions

View File

@ -465,6 +465,7 @@ class SendHeartbeatsThread(threading.Thread):
self.include = SETTINGS.get('include', []) self.include = SETTINGS.get('include', [])
self.hidefilenames = SETTINGS.get('hidefilenames') self.hidefilenames = SETTINGS.get('hidefilenames')
self.proxy = SETTINGS.get('proxy') self.proxy = SETTINGS.get('proxy')
self.python_binary = SETTINGS.get('python_binary')
self.heartbeat = heartbeat self.heartbeat = heartbeat
self.has_extra_heartbeats = False self.has_extra_heartbeats = False
@ -501,11 +502,14 @@ class SendHeartbeatsThread(threading.Thread):
return heartbeat return heartbeat
def send_heartbeats(self): def send_heartbeats(self):
if python_binary(): python = self.python_binary
if not python or not python.strip():
python = python_binary()
if python:
heartbeat = self.build_heartbeat(**self.heartbeat) heartbeat = self.build_heartbeat(**self.heartbeat)
ua = 'sublime/%d sublime-wakatime/%s' % (ST_VERSION, __version__) ua = 'sublime/%d sublime-wakatime/%s' % (ST_VERSION, __version__)
cmd = [ cmd = [
python_binary(), python,
API_CLIENT, API_CLIENT,
'--entity', heartbeat['entity'], '--entity', heartbeat['entity'],
'--time', str('%f' % heartbeat['timestamp']), '--time', str('%f' % heartbeat['timestamp']),

View File

@ -29,5 +29,8 @@
"status_bar_message_fmt": "WakaTime {status} %I:%M %p", "status_bar_message_fmt": "WakaTime {status} %I:%M %p",
// Obfuscate file paths when sending to API. Your dashboard will no longer display coding activity per file. // Obfuscate file paths when sending to API. Your dashboard will no longer display coding activity per file.
"hidefilenames": false "hidefilenames": false,
// Python binary location. Uses python from your PATH by default.
"python_binary": ""
} }