upgrade wakatime package

This commit is contained in:
Alan Hamlett 2013-10-25 21:32:30 -07:00
parent 6fab0d2fde
commit d664279297
2 changed files with 22 additions and 0 deletions

View file

@ -11,6 +11,7 @@
import logging
import os
import platform
from subprocess import Popen, PIPE
from .base import BaseProject
@ -62,6 +63,8 @@ class Subversion(BaseProject):
return info
def _find_project_base(self, path, found=False):
if platform.system() == 'Windows':
return False
path = os.path.realpath(path)
if os.path.isfile(path):
path = os.path.split(path)[0]

View file

@ -23,7 +23,17 @@ from pygments.lexers import guess_lexer_for_filename
log = logging.getLogger(__name__)
# force file name extensions to be recognized as a certain language
EXTENSIONS = {
'md': 'Markdown',
}
def guess_language(file_name):
if file_name:
language = guess_language_from_extension(file_name.rsplit('.', 1)[-1])
if language:
return language
lexer = None
try:
with open(file_name) as f:
@ -36,6 +46,15 @@ def guess_language(file_name):
return None
def guess_language_from_extension(extension):
if extension:
if extension in EXTENSIONS:
return EXTENSIONS[extension]
if extension.lower() in EXTENSIONS:
return mapping[EXTENSIONS.lower()]
return None
def number_lines_in_file(file_name):
lines = 0
try: