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
504d4012
Commit
504d4012
authored
Aug 07, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused _all_dirs. Prefer 'candidate' to 'suitable'. Update documentation.
parent
565dd069
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
setuptools/__init__.py
setuptools/__init__.py
+8
-15
No files found.
setuptools/__init__.py
View file @
504d4012
...
...
@@ -73,31 +73,24 @@ class PackageFinder(object):
yield
pkg
@
staticmethod
def
_
all
_dirs
(
base_path
):
def
_
candidate
_dirs
(
base_path
):
"""
Return all dirs in base_path
, relative to base_path
Return all dirs in base_path
that might be packages.
"""
has_dot
=
lambda
name
:
'.'
in
name
for
root
,
dirs
,
files
in
os
.
walk
(
base_path
,
followlinks
=
True
):
for
dir
in
dirs
:
yield
os
.
path
.
relpath
(
os
.
path
.
join
(
root
,
dir
),
base_path
)
@
staticmethod
def
_suitable_dirs
(
base_path
):
"""
Return all suitable package dirs in base_path, relative to base_path
"""
for
root
,
dirs
,
files
in
os
.
walk
(
base_path
,
followlinks
=
True
):
# Mutate dirs to trim the search:
dirs
[:]
=
filterfalse
(
lambda
n
:
'.'
in
n
,
dirs
)
# Exclude directories that contain a period, as they cannot be
# packages. Mutate the list to avoid traversal.
dirs
[:]
=
filterfalse
(
has_dot
,
dirs
)
for
dir
in
dirs
:
yield
os
.
path
.
relpath
(
os
.
path
.
join
(
root
,
dir
),
base_path
)
@
classmethod
def
_find_packages_iter
(
cls
,
base_path
):
suitable
=
cls
.
_suitabl
e_dirs
(
base_path
)
candidates
=
cls
.
_candidat
e_dirs
(
base_path
)
return
(
path
.
replace
(
os
.
path
.
sep
,
'.'
)
for
path
in
suitable
for
path
in
candidates
if
cls
.
_looks_like_package
(
os
.
path
.
join
(
base_path
,
path
))
)
...
...
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