summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flake8/utils.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/flake8/utils.py b/src/flake8/utils.py
index 7f31f8f..f432dac 100644
--- a/src/flake8/utils.py
+++ b/src/flake8/utils.py
@@ -53,12 +53,15 @@ def normalize_path(path, parent=os.curdir):
:rtype:
str
"""
- # NOTE(sigmavirus24): Using os.path.sep allows for Windows paths to
- # be specified and work appropriately.
+ # NOTE(sigmavirus24): Using os.path.sep and os.path.altsep allow for
+ # Windows compatibility with both Windows-style paths (c:\\foo\bar) and
+ # Unix style paths (/foo/bar).
separator = os.path.sep
- if separator in path:
+ # NOTE(sigmavirus24): os.path.altsep may be None
+ alternate_separator = os.path.altsep or ''
+ if separator in path or alternate_separator in path:
path = os.path.abspath(os.path.join(parent, path))
- return path.rstrip(separator)
+ return path.rstrip(separator + alternate_separator)
def stdin_get_value():