summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-06-03 07:44:41 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-06-03 07:44:41 -0500
commit250005b100a4d932643e169027fc6cfe78dff520 (patch)
treeed7ddcf68dc566df56ac0712a3a8f5cc44c78b1c
parentba2d94888c2989da70fe025aad50eaee1206dc6f (diff)
downloadflake8-250005b100a4d932643e169027fc6cfe78dff520.tar.gz
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
-rw-r--r--flake8/utils.py7
1 files 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():