From cf2c5c07ad815ec49177ea1a6629c6f0cf127ae8 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Sun, 21 Jul 2013 10:30:06 -0700 Subject: [PATCH] v0.1.4 use os.path for Windows compatible config file path. no longer importing BaseProject to prevent possible circular import. --- wakatime/__init__.py | 14 +++++++++----- wakatime/project.py | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/wakatime/__init__.py b/wakatime/__init__.py index a27cd6f..e60b9a1 100644 --- a/wakatime/__init__.py +++ b/wakatime/__init__.py @@ -12,7 +12,7 @@ from __future__ import print_function __title__ = 'wakatime' -__version__ = '0.1.3' +__version__ = '0.1.4' __author__ = 'Alan Hamlett' __license__ = 'BSD' __copyright__ = 'Copyright 2013 Alan Hamlett' @@ -88,10 +88,10 @@ def parseArguments(argv): def get_api_key(configFile): if not configFile: - configFile = '~/.wakatime.conf' + configFile = os.path.join(os.path.expanduser('~'), '.wakatime.conf') api_key = None try: - cf = open(os.path.expanduser(configFile)) + cf = open(configFile) for line in cf: line = line.split('=', 1) if line[0] == 'api_key': @@ -170,9 +170,13 @@ def main(argv=None): args = parseArguments(argv) setup_logging(args, __version__) if os.path.isfile(args.targetFile): + tags = [] + name = None project = find_project(args.targetFile) - tags = project.tags() - if send_action(project=project.name(), tags=tags, **vars(args)): + if project: + tags = project.tags() + name = project.name() + if send_action(project=name, tags=tags, **vars(args)): return 0 return 102 else: diff --git a/wakatime/project.py b/wakatime/project.py index 4d33635..783f2cb 100644 --- a/wakatime/project.py +++ b/wakatime/project.py @@ -12,7 +12,6 @@ import logging import os -from .projects.base import BaseProject from .projects.git import Git from .projects.mercurial import Mercurial from .projects.subversion import Subversion @@ -32,4 +31,4 @@ def find_project(path): project = plugin(path) if project.process(): return project - return BaseProject(path) + return None