diff --git a/packages/wakatime/HISTORY.rst b/packages/wakatime/HISTORY.rst index b2d6a1f..e92f48e 100644 --- a/packages/wakatime/HISTORY.rst +++ b/packages/wakatime/HISTORY.rst @@ -3,6 +3,18 @@ History ------- +2.0.7 (2014-08-27) +++++++++++++++++++ + +- find svn binary location from common install directories + + +2.0.6 (2014-08-07) +++++++++++++++++++ + +- encode json data as str when passing to urllib + + 2.0.5 (2014-07-25) ++++++++++++++++++ diff --git a/packages/wakatime/wakatime/__init__.py b/packages/wakatime/wakatime/__init__.py index 0774018..f286714 100644 --- a/packages/wakatime/wakatime/__init__.py +++ b/packages/wakatime/wakatime/__init__.py @@ -13,7 +13,7 @@ from __future__ import print_function __title__ = 'wakatime' -__version__ = '2.0.6' +__version__ = '2.0.7' __author__ = 'Alan Hamlett' __license__ = 'BSD' __copyright__ = 'Copyright 2014 Alan Hamlett' diff --git a/packages/wakatime/wakatime/projects/subversion.py b/packages/wakatime/wakatime/projects/subversion.py index 5a5551e..6e49bf5 100644 --- a/packages/wakatime/wakatime/projects/subversion.py +++ b/packages/wakatime/wakatime/projects/subversion.py @@ -32,6 +32,7 @@ except NameError: class Subversion(BaseProject): + binary_location = None def process(self): return self._find_project_base(self.path) @@ -44,13 +45,31 @@ class Subversion(BaseProject): unicode(os.path.basename(self.base)) return None + def _find_binary(self): + if self.binary_location: + return self.binary_location + locations = [ + 'svn', + '/usr/bin/svn', + '/usr/local/bin/svn', + ] + for location in locations: + try: + Popen([location, '--version']) + self.binary_location = location + return location + except: + pass + self.binary_location = 'svn' + return 'svn' + def _get_info(self, path): info = OrderedDict() stdout = None try: os.environ['LANG'] = 'en_US' stdout, stderr = Popen([ - 'svn', 'info', os.path.realpath(path) + self._find_binary(), 'info', os.path.realpath(path) ], stdout=PIPE, stderr=PIPE).communicate() except OSError: pass