Skip to content

Commit 37d03fc

Browse files
committed
[FIX] pylint_odoo: Fix walk-up normalizing windows OS separator // vs \\
1 parent 4c79fec commit 37d03fc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/pylint_odoo/misc.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,20 @@ def top_path(path):
8989
return path.root or path.drive
9090

9191

92+
def full_norm_path(path):
93+
"""Expand paths in all possible ways"""
94+
return os.path.normpath(os.path.realpath(os.path.abspath(os.path.expanduser(os.path.expandvars(path.strip())))))
95+
96+
9297
@lru_cache(maxsize=256)
9398
def walk_up(path, filenames, top):
9499
"""Look for "filenames" walking up in parent paths of "path"
95100
but limited only to "top" path
96101
"""
97-
if path == top:
102+
if full_norm_path(path) == full_norm_path(top):
98103
return None
99104
for filename in filenames:
100105
path_filename = os.path.join(path, filename)
101-
if os.path.isfile(path_filename):
106+
if os.path.isfile(full_norm_path(path_filename)):
102107
return path_filename
103108
return walk_up(os.path.dirname(path), filenames, top)

0 commit comments

Comments
 (0)