upgrade wakatime-cli to v3.0.1
This commit is contained in:
parent
8eb0ca0ce5
commit
dcafa11324
3 changed files with 19 additions and 10 deletions
|
@ -3,6 +3,12 @@ History
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
||||||
|
3.0.1 (2014-12-23)
|
||||||
|
++++++++++++++++++
|
||||||
|
|
||||||
|
- handle unknown language when parsing dependencies
|
||||||
|
|
||||||
|
|
||||||
3.0.0 (2014-12-23)
|
3.0.0 (2014-12-23)
|
||||||
++++++++++++++++++
|
++++++++++++++++++
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
__title__ = 'wakatime'
|
__title__ = 'wakatime'
|
||||||
__version__ = '3.0.0'
|
__version__ = '3.0.1'
|
||||||
__author__ = 'Alan Hamlett'
|
__author__ = 'Alan Hamlett'
|
||||||
__license__ = 'BSD'
|
__license__ = 'BSD'
|
||||||
__copyright__ = 'Copyright 2014 Alan Hamlett'
|
__copyright__ = 'Copyright 2014 Alan Hamlett'
|
||||||
|
|
|
@ -42,8 +42,10 @@ class TokenParser(object):
|
||||||
self._save_dependency(dep, truncate=truncate)
|
self._save_dependency(dep, truncate=truncate)
|
||||||
|
|
||||||
def _extract_tokens(self):
|
def _extract_tokens(self):
|
||||||
with open(self.source_file, 'r', encoding='utf-8') as fh:
|
if self.lexer:
|
||||||
return self.lexer.get_tokens_unprocessed(fh.read(512000))
|
with open(self.source_file, 'r', encoding='utf-8') as fh:
|
||||||
|
return self.lexer.get_tokens_unprocessed(fh.read(512000))
|
||||||
|
return []
|
||||||
|
|
||||||
def _save_dependency(self, dep, truncate=True):
|
def _save_dependency(self, dep, truncate=True):
|
||||||
dep = dep.strip().split('.')[0].strip() if truncate else dep.strip()
|
dep = dep.strip().split('.')[0].strip() if truncate else dep.strip()
|
||||||
|
@ -60,13 +62,14 @@ class DependencyParser(object):
|
||||||
self.source_file = source_file
|
self.source_file = source_file
|
||||||
self.lexer = lexer
|
self.lexer = lexer
|
||||||
|
|
||||||
try:
|
if self.lexer:
|
||||||
module_name = self.lexer.__module__.split('.')[-1]
|
try:
|
||||||
class_name = self.lexer.__class__.__name__.replace('Lexer', 'Parser', 1)
|
module_name = self.lexer.__module__.split('.')[-1]
|
||||||
module = import_module('.%s' % module_name, package=__package__)
|
class_name = self.lexer.__class__.__name__.replace('Lexer', 'Parser', 1)
|
||||||
self.parser = getattr(module, class_name)
|
module = import_module('.%s' % module_name, package=__package__)
|
||||||
except ImportError as ex:
|
self.parser = getattr(module, class_name)
|
||||||
log.debug(ex)
|
except ImportError as ex:
|
||||||
|
log.debug(ex)
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
if self.parser:
|
if self.parser:
|
||||||
|
|
Loading…
Reference in a new issue