v0.1.4 use os.path for Windows compatible config file path. no longer importing BaseProject to prevent possible circular import.

This commit is contained in:
Alan Hamlett 2013-07-21 10:30:06 -07:00
parent 11750c0f91
commit cf2c5c07ad
2 changed files with 10 additions and 7 deletions

View file

@ -12,7 +12,7 @@
from __future__ import print_function from __future__ import print_function
__title__ = 'wakatime' __title__ = 'wakatime'
__version__ = '0.1.3' __version__ = '0.1.4'
__author__ = 'Alan Hamlett' __author__ = 'Alan Hamlett'
__license__ = 'BSD' __license__ = 'BSD'
__copyright__ = 'Copyright 2013 Alan Hamlett' __copyright__ = 'Copyright 2013 Alan Hamlett'
@ -88,10 +88,10 @@ def parseArguments(argv):
def get_api_key(configFile): def get_api_key(configFile):
if not configFile: if not configFile:
configFile = '~/.wakatime.conf' configFile = os.path.join(os.path.expanduser('~'), '.wakatime.conf')
api_key = None api_key = None
try: try:
cf = open(os.path.expanduser(configFile)) cf = open(configFile)
for line in cf: for line in cf:
line = line.split('=', 1) line = line.split('=', 1)
if line[0] == 'api_key': if line[0] == 'api_key':
@ -170,9 +170,13 @@ def main(argv=None):
args = parseArguments(argv) args = parseArguments(argv)
setup_logging(args, __version__) setup_logging(args, __version__)
if os.path.isfile(args.targetFile): if os.path.isfile(args.targetFile):
tags = []
name = None
project = find_project(args.targetFile) project = find_project(args.targetFile)
if project:
tags = project.tags() tags = project.tags()
if send_action(project=project.name(), tags=tags, **vars(args)): name = project.name()
if send_action(project=name, tags=tags, **vars(args)):
return 0 return 0
return 102 return 102
else: else:

View file

@ -12,7 +12,6 @@
import logging import logging
import os import os
from .projects.base import BaseProject
from .projects.git import Git from .projects.git import Git
from .projects.mercurial import Mercurial from .projects.mercurial import Mercurial
from .projects.subversion import Subversion from .projects.subversion import Subversion
@ -32,4 +31,4 @@ def find_project(path):
project = plugin(path) project = plugin(path)
if project.process(): if project.process():
return project return project
return BaseProject(path) return None