From 9167eb25585420032c6275881dc4ea9ba521ac74 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Mon, 24 Oct 2016 12:39:37 +0200 Subject: [PATCH] upgrade wakatime-cli to v6.2.0 --- packages/wakatime/__about__.py | 2 +- packages/wakatime/dependencies/__init__.py | 4 ++-- packages/wakatime/main.py | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/wakatime/__about__.py b/packages/wakatime/__about__.py index 5264594..3d10fb7 100644 --- a/packages/wakatime/__about__.py +++ b/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', '9') +__version_info__ = ('6', '2', '0') __version__ = '.'.join(__version_info__) __author__ = 'Alan Hamlett' __author_email__ = 'alan@wakatime.com' diff --git a/packages/wakatime/dependencies/__init__.py b/packages/wakatime/dependencies/__init__.py index 261eba3..dccb3bf 100644 --- a/packages/wakatime/dependencies/__init__.py +++ b/packages/wakatime/dependencies/__init__.py @@ -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: diff --git a/packages/wakatime/main.py b/packages/wakatime/main.py index 432f41b..83b772a 100644 --- a/packages/wakatime/main.py +++ b/packages/wakatime/main.py @@ -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'):