Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8596ef70
Kaydet (Commit)
8596ef70
authored
Eki 19, 2010
tarafından
Hirokazu Yamamoto
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #5117: My previous commit for this issue broke posix buildbot.
üst
50f7d7e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
ntpath.py
Lib/ntpath.py
+23
-12
No files found.
Lib/ntpath.py
Dosyayı görüntüle @
8596ef70
...
...
@@ -483,27 +483,38 @@ realpath = abspath
supports_unicode_filenames
=
(
hasattr
(
sys
,
"getwindowsversion"
)
and
sys
.
getwindowsversion
()[
3
]
>=
2
)
def
_abspath_split
(
path
):
abs
=
abspath
(
normpath
(
path
))
prefix
,
rest
=
splitunc
(
abs
)
is_unc
=
bool
(
prefix
)
if
not
is_unc
:
prefix
,
rest
=
splitdrive
(
abs
)
return
is_unc
,
prefix
,
[
x
for
x
in
rest
.
split
(
sep
)
if
x
]
def
relpath
(
path
,
start
=
curdir
):
"""Return a relative version of a path"""
if
not
path
:
raise
ValueError
(
"no path specified"
)
start_list
=
[
x
for
x
in
abspath
(
start
)
.
split
(
sep
)
if
x
]
path_list
=
[
x
for
x
in
abspath
(
path
)
.
split
(
sep
)
if
x
]
if
start_list
[
0
]
.
lower
()
!=
path_list
[
0
]
.
lower
():
unc_path
,
rest
=
splitunc
(
path
)
unc_start
,
rest
=
splitunc
(
start
)
if
bool
(
unc_path
)
^
bool
(
unc_start
):
raise
ValueError
(
"Cannot mix UNC and non-UNC paths (
%
s and
%
s)"
%
(
path
,
start
))
start_is_unc
,
start_prefix
,
start_list
=
_abspath_split
(
start
)
path_is_unc
,
path_prefix
,
path_list
=
_abspath_split
(
path
)
if
path_is_unc
^
start_is_unc
:
raise
ValueError
(
"Cannot mix UNC and non-UNC paths (
%
s and
%
s)"
%
(
path
,
start
))
if
path_prefix
.
lower
()
!=
start_prefix
.
lower
():
if
path_is_unc
:
raise
ValueError
(
"path is on UNC root
%
s, start on UNC root
%
s"
%
(
path_prefix
,
start_prefix
))
else
:
raise
ValueError
(
"path is on drive
%
s, start on drive
%
s"
%
(
path_
list
[
0
],
start_list
[
0
]
))
%
(
path_
prefix
,
start_prefix
))
# Work out how much of the filepath is shared by start and path.
for
i
in
range
(
min
(
len
(
start_list
),
len
(
path_list
))):
if
start_list
[
i
]
.
lower
()
!=
path_list
[
i
]
.
lower
():
i
=
0
for
e1
,
e2
in
zip
(
start_list
,
path_list
):
if
e1
.
lower
()
!=
e2
.
lower
():
break
else
:
i
+=
1
rel_list
=
[
pardir
]
*
(
len
(
start_list
)
-
i
)
+
path_list
[
i
:]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment