Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
ea867080
Commit
ea867080
authored
Jul 30, 2000
by
Greg Ward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed 'select_pattern()' to 'include_pattern()'.
Other cosmetic/doc/comment tweaks.
parent
aab3b0d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
filelist.py
filelist.py
+16
-15
No files found.
filelist.py
View file @
ea867080
...
@@ -105,7 +105,7 @@ class FileList:
...
@@ -105,7 +105,7 @@ class FileList:
def
process_template_line
(
self
,
line
):
def
process_template_line
(
self
,
line
):
# Parse the line: split it up, make sure the right number of words
# Parse the line: split it up, make sure the right number of words
#
are
there, and return the relevant words. 'action' is always
#
is
there, and return the relevant words. 'action' is always
# defined: it's the first word of the line. Which of the other
# defined: it's the first word of the line. Which of the other
# three are defined depends on the action; it'll be either
# three are defined depends on the action; it'll be either
# patterns, (dir and patterns), or (dir_pattern).
# patterns, (dir and patterns), or (dir_pattern).
...
@@ -117,7 +117,7 @@ class FileList:
...
@@ -117,7 +117,7 @@ class FileList:
if
action
==
'include'
:
if
action
==
'include'
:
self
.
debug_print
(
"include "
+
string
.
join
(
patterns
))
self
.
debug_print
(
"include "
+
string
.
join
(
patterns
))
for
pattern
in
patterns
:
for
pattern
in
patterns
:
if
not
self
.
select
_pattern
(
pattern
,
anchor
=
1
):
if
not
self
.
include
_pattern
(
pattern
,
anchor
=
1
):
self
.
warn
(
"no files found matching '%s'"
%
pattern
)
self
.
warn
(
"no files found matching '%s'"
%
pattern
)
elif
action
==
'exclude'
:
elif
action
==
'exclude'
:
...
@@ -131,7 +131,7 @@ class FileList:
...
@@ -131,7 +131,7 @@ class FileList:
elif
action
==
'global-include'
:
elif
action
==
'global-include'
:
self
.
debug_print
(
"global-include "
+
string
.
join
(
patterns
))
self
.
debug_print
(
"global-include "
+
string
.
join
(
patterns
))
for
pattern
in
patterns
:
for
pattern
in
patterns
:
if
not
self
.
select
_pattern
(
pattern
,
anchor
=
0
):
if
not
self
.
include
_pattern
(
pattern
,
anchor
=
0
):
self
.
warn
((
"no files found matching '%s' "
+
self
.
warn
((
"no files found matching '%s' "
+
"anywhere in distribution"
)
%
"anywhere in distribution"
)
%
pattern
)
pattern
)
...
@@ -148,7 +148,7 @@ class FileList:
...
@@ -148,7 +148,7 @@ class FileList:
self
.
debug_print
(
"recursive-include %s %s"
%
self
.
debug_print
(
"recursive-include %s %s"
%
(
dir
,
string
.
join
(
patterns
)))
(
dir
,
string
.
join
(
patterns
)))
for
pattern
in
patterns
:
for
pattern
in
patterns
:
if
not
self
.
select
_pattern
(
pattern
,
prefix
=
dir
):
if
not
self
.
include
_pattern
(
pattern
,
prefix
=
dir
):
self
.
warn
((
"no files found matching '%s' "
+
self
.
warn
((
"no files found matching '%s' "
+
"under directory '%s'"
)
%
"under directory '%s'"
)
%
(
pattern
,
dir
))
(
pattern
,
dir
))
...
@@ -164,7 +164,7 @@ class FileList:
...
@@ -164,7 +164,7 @@ class FileList:
elif
action
==
'graft'
:
elif
action
==
'graft'
:
self
.
debug_print
(
"graft "
+
dir_pattern
)
self
.
debug_print
(
"graft "
+
dir_pattern
)
if
not
self
.
select
_pattern
(
None
,
prefix
=
dir_pattern
):
if
not
self
.
include
_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'
:
elif
action
==
'prune'
:
...
@@ -180,14 +180,15 @@ class FileList:
...
@@ -180,14 +180,15 @@ class FileList:
# process_template_line ()
# process_template_line ()
def
select
_pattern
(
self
,
pattern
,
def
include
_pattern
(
self
,
pattern
,
anchor
=
1
,
prefix
=
None
,
is_regex
=
0
):
anchor
=
1
,
prefix
=
None
,
is_regex
=
0
):
"""Select strings (presumably filenames) from 'files' that match
'pattern', a Unix-style wildcard (glob) pattern. Patterns are not
"""Select strings (presumably filenames) from 'self.files' that
quite the same as implemented by the 'fnmatch' module: '*' and '?'
match 'pattern', a Unix-style wildcard (glob) pattern. Patterns
match non-special characters, where "special" is platform-dependent:
are not quite the same as implemented by the 'fnmatch' module: '*'
slash on Unix, colon, slash, and backslash on DOS/Windows, and colon on
and '?' match non-special characters, where "special" is platform-
Mac OS.
dependent: slash on Unix; colon, slash, and backslash on
DOS/Windows; and colon on Mac OS.
If 'anchor' is true (the default), then the pattern match is more
If 'anchor' is true (the default), then the pattern match is more
stringent: "*.py" will match "foo.py" but not "foo/bar.py". If
stringent: "*.py" will match "foo.py" but not "foo/bar.py". If
...
@@ -208,7 +209,7 @@ class FileList:
...
@@ -208,7 +209,7 @@ class FileList:
"""
"""
files_found
=
0
files_found
=
0
pattern_re
=
translate_pattern
(
pattern
,
anchor
,
prefix
,
is_regex
)
pattern_re
=
translate_pattern
(
pattern
,
anchor
,
prefix
,
is_regex
)
self
.
debug_print
(
"
select
_pattern: applying regex r'%s'"
%
self
.
debug_print
(
"
include
_pattern: applying regex r'%s'"
%
pattern_re
.
pattern
)
pattern_re
.
pattern
)
# delayed loading of allfiles list
# delayed loading of allfiles list
...
@@ -222,14 +223,14 @@ class FileList:
...
@@ -222,14 +223,14 @@ class FileList:
return
files_found
return
files_found
#
select
_pattern ()
#
include
_pattern ()
def
exclude_pattern
(
self
,
pattern
,
def
exclude_pattern
(
self
,
pattern
,
anchor
=
1
,
prefix
=
None
,
is_regex
=
0
):
anchor
=
1
,
prefix
=
None
,
is_regex
=
0
):
"""Remove strings (presumably filenames) from 'files' that match
"""Remove strings (presumably filenames) from 'files' that match
'pattern'. Other parameters are the same as for
'pattern'. Other parameters are the same as for
'
select
_pattern()', above.
'
include
_pattern()', above.
The list 'self.files' is modified in place.
The list 'self.files' is modified in place.
Return 1 if files are found.
Return 1 if files are found.
"""
"""
...
...
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