From 5e0e9f913f929b137ef054605759e934ece20c4c Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Mon, 16 May 2016 16:10:32 +0200 Subject: [PATCH] upgrade wakatime-cli to v6.0.2 --- plugin/packages/wakatime/__about__.py | 2 +- .../packages/wakatime/projects/subversion.py | 46 +++++++++++++------ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/plugin/packages/wakatime/__about__.py b/plugin/packages/wakatime/__about__.py index ea70956..9075cf3 100644 --- a/plugin/packages/wakatime/__about__.py +++ b/plugin/packages/wakatime/__about__.py @@ -1,7 +1,7 @@ __title__ = 'wakatime' __description__ = 'Common interface to the WakaTime api.' __url__ = 'https://github.com/wakatime/wakatime' -__version_info__ = ('6', '0', '1') +__version_info__ = ('6', '0', '2') __version__ = '.'.join(__version_info__) __author__ = 'Alan Hamlett' __author_email__ = 'alan@wakatime.com' diff --git a/plugin/packages/wakatime/projects/subversion.py b/plugin/packages/wakatime/projects/subversion.py index 33617ad..16935f0 100644 --- a/plugin/packages/wakatime/projects/subversion.py +++ b/plugin/packages/wakatime/projects/subversion.py @@ -62,21 +62,22 @@ class Subversion(BaseProject): def _get_info(self, path): info = OrderedDict() - stdout = None - try: - os.environ['LANG'] = 'en_US' - stdout, stderr = Popen([ - self._find_binary(), 'info', os.path.realpath(path) - ], stdout=PIPE, stderr=PIPE).communicate() - except OSError: - pass - else: - if stdout: - for line in stdout.splitlines(): - line = u(line) - line = line.split(': ', 1) - if len(line) == 2: - info[line[0]] = line[1] + if not self._is_mac() or self._has_xcode_tools(): + stdout = None + try: + os.environ['LANG'] = 'en_US' + stdout, stderr = Popen([ + self._find_binary(), 'info', os.path.realpath(path) + ], stdout=PIPE, stderr=PIPE).communicate() + except OSError: + pass + else: + if stdout: + for line in stdout.splitlines(): + line = u(line) + line = line.split(': ', 1) + if len(line) == 2: + info[line[0]] = line[1] return info def _find_project_base(self, path, found=False): @@ -97,3 +98,18 @@ class Subversion(BaseProject): return found return self._find_project_base(split_path[0], found) + def _is_mac(self): + return platform.system() == 'Darwin' + + def _has_xcode_tools(self): + try: + with open(os.devnull, 'wb') as DEVNULL: + proc = Popen(['/usr/bin/xcode-select', '-p'], stdout=DEVNULL, stderr=DEVNULL) + proc.communicate() + retval = proc.wait() + if retval == 0: + return True + except: + pass + return False +