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
7b3d56c8
Kaydet (Commit)
7b3d56c8
authored
Tem 30, 2000
tarafından
Greg Ward
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Renamed 'process_line()' to 'process_template_line()', and factored out
'_parse_template_line()'.
üst
c98927a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
69 deletions
+63
-69
filelist.py
Lib/distutils/filelist.py
+63
-69
No files found.
Lib/distutils/filelist.py
Dosyayı görüntüle @
7b3d56c8
...
...
@@ -16,6 +16,7 @@ import fnmatch
from
types
import
*
from
glob
import
glob
from
distutils.util
import
convert_path
from
distutils.errors
import
DistutilsTemplateError
,
DistutilsInternalError
class
FileList
:
...
...
@@ -64,126 +65,119 @@ class FileList:
print
msg
def
process_line
(
self
,
line
):
def
_parse_template_line
(
self
,
line
):
words
=
string
.
split
(
line
)
action
=
words
[
0
]
# First, check that the right number of words are present
# for the given action (which is the first word)
if
action
in
(
'include'
,
'exclude'
,
'global-include'
,
'global-exclude'
):
patterns
=
dir
=
dir_pattern
=
None
if
action
in
(
'include'
,
'exclude'
,
'global-include'
,
'global-exclude'
):
if
len
(
words
)
<
2
:
self
.
warn
\
(
"invalid template line: "
+
"'
%
s' expects <pattern1> <pattern2> ..."
%
action
)
return
raise
DistutilsTemplateError
,
\
"'
%
s' expects <pattern1> <pattern2> ..."
%
action
pattern
_list
=
map
(
convert_path
,
words
[
1
:])
pattern
s
=
map
(
convert_path
,
words
[
1
:])
elif
action
in
(
'recursive-include'
,
'recursive-exclude'
):
elif
action
in
(
'recursive-include'
,
'recursive-exclude'
):
if
len
(
words
)
<
3
:
self
.
warn
\
(
"invalid template line: "
+
"'
%
s' expects <dir> <pattern1> <pattern2> ..."
%
action
)
return
raise
DistutilsTemplateError
,
\
"'
%
s' expects <dir> <pattern1> <pattern2> ..."
%
action
dir
=
convert_path
(
words
[
1
])
pattern
_list
=
map
(
convert_path
,
words
[
2
:])
pattern
s
=
map
(
convert_path
,
words
[
2
:])
elif
action
in
(
'graft'
,
'prune'
):
elif
action
in
(
'graft'
,
'prune'
):
if
len
(
words
)
!=
2
:
self
.
warn
\
(
"invalid template line: "
+
"'
%
s' expects a single <dir_pattern>"
%
action
)
return
raise
DistutilsTemplateError
,
\
"'
%
s' expects a single <dir_pattern>"
%
action
dir_pattern
=
convert_path
(
words
[
1
])
dir_pattern
=
convert_path
(
words
[
1
])
else
:
self
.
warn
(
"invalid template line: "
+
"unknown action '
%
s'"
%
action
)
return
raise
DistutilsTemplateError
,
"unknown action '
%
s'"
%
action
return
(
action
,
pattern
,
dir
,
dir_pattern
)
# _parse_template_line ()
def
process_template_line
(
self
,
line
):
# Parse the line: split it up, make sure the right number of words
# are there, and return the relevant words. 'action' is always
# defined: it's the first word of the line. Which of the other
# three are defined depends on the action; it'll be either
# patterns, (dir and patterns), or (dir_pattern).
(
action
,
patterns
,
dir
,
dir_pattern
)
=
self
.
_parse_template_line
(
line
)
# OK, now we know that the action is valid and we have the
# right number of words on the line for that action -- so we
# can proceed with minimal error-checking. Also, we have
# defined either (pattern), (dir and pattern), or
# (dir_pattern) -- so we don't have to spend any time
# digging stuff up out of 'words'.
# can proceed with minimal error-checking.
if
action
==
'include'
:
self
.
debug_print
(
"include "
+
string
.
join
(
pattern
_list
))
for
pattern
in
pattern
_list
:
self
.
debug_print
(
"include "
+
string
.
join
(
pattern
s
))
for
pattern
in
pattern
s
:
if
not
self
.
select_pattern
(
pattern
,
anchor
=
1
):
self
.
warn
(
"no files found matching '
%
s'"
%
pattern
)
self
.
warn
(
"no files found matching '
%
s'"
%
pattern
)
elif
action
==
'exclude'
:
self
.
debug_print
(
"exclude "
+
string
.
join
(
pattern
_list
))
for
pattern
in
pattern
_list
:
self
.
debug_print
(
"exclude "
+
string
.
join
(
pattern
s
))
for
pattern
in
pattern
s
:
if
not
self
.
exclude_pattern
(
pattern
,
anchor
=
1
):
self
.
warn
(
self
.
warn
(
"no previously-included files found matching '
%
s'"
%
pattern
)
elif
action
==
'global-include'
:
self
.
debug_print
(
"global-include "
+
string
.
join
(
pattern
_list
))
for
pattern
in
pattern
_list
:
self
.
debug_print
(
"global-include "
+
string
.
join
(
pattern
s
))
for
pattern
in
pattern
s
:
if
not
self
.
select_pattern
(
pattern
,
anchor
=
0
):
self
.
warn
((
"no files found matching '
%
s' "
+
"anywhere in distribution"
)
%
pattern
)
"anywhere in distribution"
)
%
pattern
)
elif
action
==
'global-exclude'
:
self
.
debug_print
(
"global-exclude "
+
string
.
join
(
pattern
_list
))
for
pattern
in
pattern
_list
:
self
.
debug_print
(
"global-exclude "
+
string
.
join
(
pattern
s
))
for
pattern
in
pattern
s
:
if
not
self
.
exclude_pattern
(
pattern
,
anchor
=
0
):
self
.
warn
\
((
"no previously-included files matching '
%
s' "
+
"found anywhere in distribution"
)
%
pattern
)
self
.
warn
((
"no previously-included files matching '
%
s' "
+
"found anywhere in distribution"
)
%
pattern
)
elif
action
==
'recursive-include'
:
self
.
debug_print
(
"recursive-include
%
s
%
s"
%
(
dir
,
string
.
join
(
pattern
_list
)))
for
pattern
in
pattern
_list
:
(
dir
,
string
.
join
(
pattern
s
)))
for
pattern
in
pattern
s
:
if
not
self
.
select_pattern
(
pattern
,
prefix
=
dir
):
self
.
warn
((
"no files found matching '
%
s' "
+
"under directory '
%
s'"
)
%
(
pattern
,
dir
))
"under directory '
%
s'"
)
%
(
pattern
,
dir
))
elif
action
==
'recursive-exclude'
:
self
.
debug_print
(
"recursive-exclude
%
s
%
s"
%
(
dir
,
string
.
join
(
pattern
_list
)))
for
pattern
in
pattern
_list
:
(
dir
,
string
.
join
(
pattern
s
)))
for
pattern
in
pattern
s
:
if
not
self
.
exclude_pattern
(
pattern
,
prefix
=
dir
):
self
.
warn
\
((
"no previously-included files matching '
%
s' "
+
"found under directory '
%
s'"
)
%
(
pattern
,
dir
))
self
.
warn
((
"no previously-included files matching '
%
s' "
+
"found under directory '
%
s'"
)
%
(
pattern
,
dir
))
elif
action
==
'graft'
:
self
.
debug_print
(
"graft "
+
dir_pattern
)
if
not
self
.
select_pattern
(
None
,
prefix
=
dir_pattern
):
self
.
warn
(
"no directories found matching '
%
s'"
%
dir_pattern
)
self
.
warn
(
"no directories found matching '
%
s'"
%
dir_pattern
)
elif
action
==
'prune'
:
self
.
debug_print
(
"prune "
+
dir_pattern
)
if
not
self
.
exclude_pattern
(
None
,
prefix
=
dir_pattern
):
self
.
warn
\
((
"no previously-included directories found "
+
"matching '
%
s'"
)
%
dir_pattern
)
self
.
warn
((
"no previously-included directories found "
+
"matching '
%
s'"
)
%
dir_pattern
)
else
:
raise
Runtime
Error
,
\
raise
DistutilsInternal
Error
,
\
"this cannot happen: invalid action '
%
s'"
%
action
# process_line ()
# process_
template_
line ()
def
select_pattern
(
self
,
pattern
,
...
...
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