Bug 1289949 - Make mozpack.path properly handle paths on mingw python. r=gps

Mingw python has a different os.path setup from native python, and has
os.sep and os.altsep reversed. In that case, the normsep function was
doing the wrong thing, leading to all sorts of problems.

While fixing this, also ensure the corresponding unit test covers this
peculiarity, even when running under the native win32 python.
This commit is contained in:
Mike Hommey
2016-07-28 18:50:57 +09:00
parent 42c3faa7db
commit ce18ecc89e
2 changed files with 34 additions and 12 deletions

View File

@@ -22,6 +22,8 @@ def normsep(path):
'''
if os.sep != '/':
path = path.replace(os.sep, '/')
if os.altsep and os.altsep != '/':
path = path.replace(os.altsep, '/')
return path