summaryrefslogtreecommitdiff
path: root/setuptools/__init__.py
diff options
context:
space:
mode:
authorWyatt Lee Baldwin <self@wyattbaldwin.com>2014-02-12 00:52:26 -0800
committerWyatt Lee Baldwin <self@wyattbaldwin.com>2014-02-12 00:52:26 -0800
commit80fc5b6d418b2df0243989b1b8c999f795f3f55e (patch)
treede140863069aff43238daab5ec746a530ce97ac5 /setuptools/__init__.py
parentc74177b8d8c565650abec45d2f90550be0c2702f (diff)
downloadpython-setuptools-git-80fc5b6d418b2df0243989b1b8c999f795f3f55e.tar.gz
Add support for PEP 420 namespace packages to find_packages()
On Python 3.3+, `find_packages()` now considers any subdirectory of the start directory that's not a regular package (i.e., that doesn't have an `__init__.py`) to be a namespace package. The other way this supports PEP 420 is by making sure `__pycache__` directories are never added to the list of packages. Fixes issue #97
Diffstat (limited to 'setuptools/__init__.py')
-rw-r--r--setuptools/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py
index a96e4c9d..86afab63 100644
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -56,7 +56,10 @@ def find_packages(where='.', exclude=(), include=()):
looks_like_package = (
'.' not in name
and os.path.isdir(fn)
- and os.path.isfile(os.path.join(fn, '__init__.py'))
+ and (
+ os.path.isfile(os.path.join(fn, '__init__.py'))
+ or sys.version_info[:2] >= (3, 3) # PEP 420
+ )
)
if looks_like_package:
pkg_name = prefix + name