upgrade wakatime-cli to v10.2.1

This commit is contained in:
Alan Hamlett
2018-04-26 08:40:02 -07:00
parent 5e34f3f6a7
commit 202df81e04
5 changed files with 191 additions and 107 deletions

View File

@@ -24,6 +24,10 @@ from .compat import u
log = logging.getLogger('WakaTime')
BACKSLASH_REPLACE_PATTERN = re.compile(r'[\\/]+')
WINDOWS_DRIVE_PATTERN = re.compile(r'^[a-z]:/')
def should_exclude(entity, include, exclude):
if entity is not None and entity.strip() != '':
for pattern in include:
@@ -74,8 +78,10 @@ def format_file_path(filepath):
try:
filepath = os.path.realpath(os.path.abspath(filepath))
filepath = re.sub(r'[/\\]', os.path.sep, filepath)
except: # pragma: nocover
filepath = re.sub(BACKSLASH_REPLACE_PATTERN, '/', filepath)
if WINDOWS_DRIVE_PATTERN.match(filepath):
filepath = filepath.capitalize()
except:
pass
return filepath