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
b248b7f8
Kaydet (Commit)
b248b7f8
authored
Haz 17, 2000
tarafından
Greg Ward
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Renamed PATH_CREATED to _path_created, on the grounds that it's private and
mutable, rather than public and constant.
üst
fcd4f873
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
dir_util.py
Lib/distutils/dir_util.py
+8
-8
No files found.
Lib/distutils/dir_util.py
Dosyayı görüntüle @
b248b7f8
...
@@ -13,7 +13,7 @@ from distutils.errors import DistutilsFileError, DistutilsInternalError
...
@@ -13,7 +13,7 @@ from distutils.errors import DistutilsFileError, DistutilsInternalError
# cache for by mkpath() -- in addition to cheapening redundant calls,
# cache for by mkpath() -- in addition to cheapening redundant calls,
# eliminates redundant "creating /foo/bar/baz" messages in dry-run mode
# eliminates redundant "creating /foo/bar/baz" messages in dry-run mode
PATH_CREATED
=
{}
_path_created
=
{}
# I don't use os.makedirs because a) it's new to Python 1.5.2, and
# I don't use os.makedirs because a) it's new to Python 1.5.2, and
# b) it blows up if the directory already exists (I want to silently
# b) it blows up if the directory already exists (I want to silently
...
@@ -28,7 +28,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
...
@@ -28,7 +28,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
summary of each mkdir to stdout. Return the list of directories
summary of each mkdir to stdout. Return the list of directories
actually created."""
actually created."""
global
PATH_CREATED
global
_path_created
# Detect a common bug -- name is None
# Detect a common bug -- name is None
if
type
(
name
)
is
not
StringType
:
if
type
(
name
)
is
not
StringType
:
...
@@ -44,7 +44,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
...
@@ -44,7 +44,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
created_dirs
=
[]
created_dirs
=
[]
if
os
.
path
.
isdir
(
name
)
or
name
==
''
:
if
os
.
path
.
isdir
(
name
)
or
name
==
''
:
return
created_dirs
return
created_dirs
if
PATH_CREATED
.
get
(
name
):
if
_path_created
.
get
(
name
):
return
created_dirs
return
created_dirs
(
head
,
tail
)
=
os
.
path
.
split
(
name
)
(
head
,
tail
)
=
os
.
path
.
split
(
name
)
...
@@ -64,7 +64,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
...
@@ -64,7 +64,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
for
d
in
tails
:
for
d
in
tails
:
#print "head = %s, d = %s: " % (head, d),
#print "head = %s, d = %s: " % (head, d),
head
=
os
.
path
.
join
(
head
,
d
)
head
=
os
.
path
.
join
(
head
,
d
)
if
PATH_CREATED
.
get
(
head
):
if
_path_created
.
get
(
head
):
continue
continue
if
verbose
:
if
verbose
:
...
@@ -78,7 +78,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
...
@@ -78,7 +78,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
raise
DistutilsFileError
,
\
raise
DistutilsFileError
,
\
"could not create '
%
s':
%
s"
%
(
head
,
exc
[
-
1
])
"could not create '
%
s':
%
s"
%
(
head
,
exc
[
-
1
])
PATH_CREATED
[
head
]
=
1
_path_created
[
head
]
=
1
return
created_dirs
return
created_dirs
# mkpath ()
# mkpath ()
...
@@ -196,7 +196,7 @@ def remove_tree (directory, verbose=0, dry_run=0):
...
@@ -196,7 +196,7 @@ def remove_tree (directory, verbose=0, dry_run=0):
(apart from being reported to stdout if 'verbose' is true).
(apart from being reported to stdout if 'verbose' is true).
"""
"""
from
distutils.util
import
grok_environment_error
from
distutils.util
import
grok_environment_error
global
PATH_CREATED
global
_path_created
if
verbose
:
if
verbose
:
print
"removing '
%
s' (and everything under it)"
%
directory
print
"removing '
%
s' (and everything under it)"
%
directory
...
@@ -208,8 +208,8 @@ def remove_tree (directory, verbose=0, dry_run=0):
...
@@ -208,8 +208,8 @@ def remove_tree (directory, verbose=0, dry_run=0):
try
:
try
:
apply
(
cmd
[
0
],
(
cmd
[
1
],))
apply
(
cmd
[
0
],
(
cmd
[
1
],))
# remove dir from cache if it's already there
# remove dir from cache if it's already there
if
PATH_CREATED
.
has_key
(
cmd
[
1
]):
if
_path_created
.
has_key
(
cmd
[
1
]):
del
PATH_CREATED
[
cmd
[
1
]]
del
_path_created
[
cmd
[
1
]]
except
(
IOError
,
OSError
),
exc
:
except
(
IOError
,
OSError
),
exc
:
if
verbose
:
if
verbose
:
print
grok_environment_error
(
print
grok_environment_error
(
...
...
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