diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-06-03 07:44:41 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-06-03 07:44:41 -0500 |
| commit | 250005b100a4d932643e169027fc6cfe78dff520 (patch) | |
| tree | ed7ddcf68dc566df56ac0712a3a8f5cc44c78b1c /flake8 | |
| parent | ba2d94888c2989da70fe025aad50eaee1206dc6f (diff) | |
| download | flake8-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
Diffstat (limited to 'flake8')
| -rw-r--r-- | flake8/utils.py | 7 |
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(): |
