Skip to content

Commit a9c8dc5

Browse files
committed
fix normalize path for Windows
1 parent 76b8651 commit a9c8dc5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

news/7625.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix normalizing path on Windows when installing package on another logical disk.

src/pip/_internal/operations/install/wheel.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,11 @@ def _record_to_fs_path(record_path):
262262
def _fs_to_record_path(path, relative_to=None):
263263
# type: (text_type, Optional[text_type]) -> RecordPath
264264
if relative_to is not None:
265-
path = os.path.relpath(path, relative_to)
265+
# On Windows, do not handle relative paths if they belong to different
266+
# logical disks
267+
if os.path.splitdrive(path)[0].lower() == \
268+
os.path.splitdrive(relative_to)[0].lower():
269+
path = os.path.relpath(path, relative_to)
266270
path = path.replace(os.path.sep, '/')
267271
return cast('RecordPath', path)
268272

0 commit comments

Comments
 (0)