Compare commits

..

5 Commits

Author SHA1 Message Date
c4c27e4e9e v7.0.12 2016-10-24 12:41:46 +02:00
9167eb2558 upgrade wakatime-cli to v6.2.0 2016-10-24 12:39:37 +02:00
eaa3bb5180 use python v3.5.2 2016-10-15 16:16:39 +02:00
7755971d11 v7.0.11 2016-09-23 08:37:30 +02:00
7634be5446 handle UnicodeDecodeError exceptions when printing log messages 2016-09-23 08:36:23 +02:00
5 changed files with 40 additions and 8 deletions

View File

@ -3,6 +3,22 @@ History
-------
7.0.12 (2016-10-24)
++++++++++++++++++
- Upgrade wakatime-cli to v6.2.0.
- Exit with status code 104 when api key is missing or invalid. Exit with
status code 103 when config file missing or invalid.
- New WAKATIME_HOME env variable for setting path to config and log files.
- Improve debug warning message from unsupported dependency parsers.
7.0.11 (2016-09-23)
++++++++++++++++++
- Handle UnicodeDecodeError when when logging. Related to #68.
7.0.10 (2016-09-22)
++++++++++++++++++

View File

@ -7,7 +7,7 @@ Website: https://wakatime.com/
==========================================================="""
__version__ = '7.0.10'
__version__ = '7.0.12'
import sublime
@ -135,7 +135,10 @@ def log(lvl, message, *args, **kwargs):
msg = message.format(*args)
elif len(kwargs) > 0:
msg = message.format(**kwargs)
print('[WakaTime] [{lvl}] {msg}'.format(lvl=lvl, msg=msg))
try:
print('[WakaTime] [{lvl}] {msg}'.format(lvl=lvl, msg=msg))
except UnicodeDecodeError:
print(u('[WakaTime] [{lvl}] {msg}').format(lvl=lvl, msg=u(msg)))
except RuntimeError:
set_timeout(lambda: log(lvl, message, *args, **kwargs), 0)
@ -572,7 +575,7 @@ class DownloadPython(threading.Thread):
def run(self):
log(INFO, 'Downloading embeddable Python...')
ver = '3.5.0'
ver = '3.5.2'
arch = 'amd64' if platform.architecture()[0] == '64bit' else 'win32'
url = 'https://www.python.org/ftp/python/{ver}/python-{ver}-embed-{arch}.zip'.format(
ver=ver,

View File

@ -1,7 +1,7 @@
__title__ = 'wakatime'
__description__ = 'Common interface to the WakaTime api.'
__url__ = 'https://github.com/wakatime/wakatime'
__version_info__ = ('6', '0', '9')
__version_info__ = ('6', '2', '0')
__version__ = '.'.join(__version_info__)
__author__ = 'Alan Hamlett'
__author_email__ = 'alan@wakatime.com'

View File

@ -117,9 +117,9 @@ class DependencyParser(object):
try:
self.parser = getattr(module, class_name)
except AttributeError:
log.debug('Module {0} is missing class {1}'.format(module.__name__, class_name))
log.debug('Parsing dependencies not supported for {0}.{1}'.format(module_name, class_name))
except ImportError:
log.traceback(logging.DEBUG)
log.debug('Parsing dependencies not supported for {0}.{1}'.format(module_name, class_name))
def parse(self):
if self.parser:

View File

@ -74,6 +74,12 @@ def parseConfigFile(configFile=None):
at ~/.wakatime.cfg.
"""
# get config file location from ENV
home = os.environ.get('WAKATIME_HOME')
if not configFile and home:
configFile = os.path.join(os.path.expanduser(home), '.wakatime.cfg')
# use default config file location
if not configFile:
configFile = os.path.join(os.path.expanduser('~'), '.wakatime.cfg')
@ -86,7 +92,8 @@ def parseConfigFile(configFile=None):
print(traceback.format_exc())
return None
except IOError:
print(u('Error: Could not read from config file {0}').format(u(configFile)))
sys.stderr.write(u("Error: Could not read from config file {0}\n").format(u(configFile)))
raise SystemExit(CONFIG_FILE_PARSE_ERROR)
return configs
@ -197,7 +204,10 @@ def parseArguments():
if default_key:
args.key = default_key
else:
parser.error('Missing api key')
try:
parser.error('Missing api key')
except SystemExit:
raise SystemExit(AUTH_ERROR)
if not args.entity:
if args.file:
args.entity = args.file
@ -240,6 +250,9 @@ def parseArguments():
args.verbose = configs.getboolean('settings', 'debug')
if not args.logfile and configs.has_option('settings', 'logfile'):
args.logfile = configs.get('settings', 'logfile')
if not args.logfile and os.environ.get('WAKATIME_HOME'):
home = os.environ.get('WAKATIME_HOME')
args.logfile = os.path.join(os.path.expanduser(home), '.wakatime.log')
if not args.api_url and configs.has_option('settings', 'api_url'):
args.api_url = configs.get('settings', 'api_url')
if not args.timeout and configs.has_option('settings', 'timeout'):