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
cc20858d
Commit
cc20858d
authored
Feb 12, 2014
by
Wyatt Lee Baldwin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add include parameter to find_packages.
--HG-- extra : rebase_source : 1fec39a038ac2c460e62ef2ee2eee5a0b66a676d
parent
193b2ee5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
CHANGES.txt
CHANGES.txt
+6
-0
setuptools/__init__.py
setuptools/__init__.py
+15
-3
No files found.
CHANGES.txt
View file @
cc20858d
...
@@ -2,6 +2,12 @@
...
@@ -2,6 +2,12 @@
CHANGES
CHANGES
=======
=======
---
3.3
---
* Add ``include`` parameter to ``setuptools.find_packages()``.
---
---
3.2
3.2
---
---
...
...
setuptools/__init__.py
View file @
cc20858d
...
@@ -28,7 +28,7 @@ run_2to3_on_doctests = True
...
@@ -28,7 +28,7 @@ run_2to3_on_doctests = True
# Standard package names for fixer packages
# Standard package names for fixer packages
lib2to3_fixer_packages
=
[
'lib2to3.fixes'
]
lib2to3_fixer_packages
=
[
'lib2to3.fixes'
]
def
find_packages
(
where
=
'.'
,
exclude
=
()):
def
find_packages
(
where
=
'.'
,
exclude
=
()
,
include
=
()
):
"""Return a list all Python packages found within directory 'where'
"""Return a list all Python packages found within directory 'where'
'where' should be supplied as a "cross-platform" (i.e. URL-style) path; it
'where' should be supplied as a "cross-platform" (i.e. URL-style) path; it
...
@@ -36,9 +36,18 @@ def find_packages(where='.', exclude=()):
...
@@ -36,9 +36,18 @@ def find_packages(where='.', exclude=()):
sequence of package names to exclude; '*' can be used as a wildcard in the
sequence of package names to exclude; '*' can be used as a wildcard in the
names, such that 'foo.*' will exclude all subpackages of 'foo' (but not
names, such that 'foo.*' will exclude all subpackages of 'foo' (but not
'foo' itself).
'foo' itself).
'include' is a sequence of package names to include. If it's specified,
only the named packages will be included. If it's not specified, all found
packages will be included. 'include' can contain shell style wildcard
patterns just like 'exclude'.
The list of included packages is built up first and then any explicitly
excluded packages are removed from it.
"""
"""
out
=
[]
out
=
[]
stack
=
[(
convert_path
(
where
),
''
)]
stack
=
[(
convert_path
(
where
),
''
)]
include
=
list
(
include
)
exclude
=
list
(
exclude
)
+
[
'ez_setup'
,
'*__pycache__'
]
exclude
=
list
(
exclude
)
+
[
'ez_setup'
,
'*__pycache__'
]
while
stack
:
while
stack
:
where
,
prefix
=
stack
.
pop
(
0
)
where
,
prefix
=
stack
.
pop
(
0
)
...
@@ -50,8 +59,11 @@ def find_packages(where='.', exclude=()):
...
@@ -50,8 +59,11 @@ def find_packages(where='.', exclude=()):
and
os
.
path
.
isfile
(
os
.
path
.
join
(
fn
,
'__init__.py'
))
and
os
.
path
.
isfile
(
os
.
path
.
join
(
fn
,
'__init__.py'
))
)
)
if
looks_like_package
:
if
looks_like_package
:
out
.
append
(
prefix
+
name
)
pkg_name
=
prefix
+
name
stack
.
append
((
fn
,
prefix
+
name
+
'.'
))
if
(
not
include
or
any
(
fnmatchcase
(
pkg_name
,
pat
)
for
pat
in
include
)):
out
.
append
(
pkg_name
)
stack
.
append
((
fn
,
pkg_name
+
'.'
))
for
pat
in
exclude
:
for
pat
in
exclude
:
out
=
[
item
for
item
in
out
if
not
fnmatchcase
(
item
,
pat
)]
out
=
[
item
for
item
in
out
if
not
fnmatchcase
(
item
,
pat
)]
return
out
return
out
...
...
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