From 250005b100a4d932643e169027fc6cfe78dff520 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Fri, 3 Jun 2016 07:44:41 -0500 Subject: [PATCH] Use platform independent path separator When normalizing paths in flake8.utils, we use the os.path.sep constant to determine if the item is intended to be a path. If Windows users then have a path like foo\bar Specified, they will get the same behaviour as a *nix user with foo/bar --- flake8/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/flake8/utils.py b/flake8/utils.py index 1ceb76f..8341a06 100644 --- a/flake8/utils.py +++ b/flake8/utils.py @@ -48,9 +48,12 @@ def normalize_path(path, parent=os.curdir): :rtype: str """ - if '/' in path: + # NOTE(sigmavirus24): Using os.path.sep allows for Windows paths to + # be specified and work appropriately. + separator = os.path.sep + if separator in path: path = os.path.abspath(os.path.join(parent, path)) - return path.rstrip('/') + return path.rstrip(separator) def stdin_get_value():