Michał Górny avatar Michał Górny committed 5af8731

Handle package.* directories recursively.

It seems that portage actually supports having directories in package.*
directories recursively. Use os.walk() to accomodate that properly.

Fixes: https://bitbucket.org/mgorny/flaggie/issue/2/if-there-is-a-dir-in-etc-portage

Comments (0)

Files changed (1)

lib/flaggie/packagefile.py

 
 		for fn in self._paths:
 			if os.path.isdir(fn):
-				files = [os.path.join(fn, x) \
-						for x in os.listdir(fn) \
-						if not x.startswith('.') and not x.endswith('~')]
+				files = []
+				for toppath, wdirs, wfiles in os.walk(fn):
+					for f in wfiles:
+						if f.startswith('.') or f.endswith('~'):
+							continue
+						files.append(os.path.join(toppath, f))
+
 				if not files:
 					files = [os.path.join(fn, 'flaggie')]
 				else:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.