Skip to content

Commit

Permalink
Consider current directory a package
Browse files Browse the repository at this point in the history
  • Loading branch information
koterpillar committed Jun 6, 2015
1 parent 35c53f1 commit 42eb5a0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions aloe/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ def find_feature_directories(cls, dir_):
the way up) and be named 'features'.
"""

# A set of directories whose parents are packages
maybe_packages = set(dir_)
# A set of package directories discovered
packages = set(dir_)

for path, dirs, files in os.walk(dir_):
if '__init__.py' in files and path in maybe_packages:
# This is a package, check subdirectories
maybe_packages |= set(join(path, dir_) for dir_ in dirs)
# Is this a package?
if '__init__.py' in files:
packages.add(path)

if path in packages:
# Does this package have a feature directory?
if 'features' in dirs:
yield join(path, 'features')

Expand Down

0 comments on commit 42eb5a0

Please sign in to comment.