From 053ed7e2f6885b001a85fc0a8759f2226a2f178a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 2 Sep 2013 14:00:19 -0400 Subject: Refactor for clarity --- setuptools/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'setuptools/__init__.py') diff --git a/setuptools/__init__.py b/setuptools/__init__.py index b048d9fd..2eb51a1f 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -41,10 +41,14 @@ def find_packages(where='.', exclude=()): where,prefix = stack.pop(0) for name in os.listdir(where): fn = os.path.join(where,name) - if ('.' not in name and os.path.isdir(fn) and - os.path.isfile(os.path.join(fn,'__init__.py')) - ): - out.append(prefix+name); stack.append((fn,prefix+name+'.')) + looks_like_package = ( + '.' not in name + and os.path.isdir(fn) + and os.path.isfile(os.path.join(fn,'__init__.py')) + ) + if looks_like_package: + out.append(prefix+name) + stack.append((fn,prefix+name+'.')) for pat in list(exclude)+['ez_setup']: from fnmatch import fnmatchcase out = [item for item in out if not fnmatchcase(item,pat)] -- cgit v1.2.1