From: Gerald B. <ger...@gm...> - 2009-10-26 20:32:25
|
This is really quick and dirty, but something like: def getdirs(dir): for d in os.listdir(dir): if not d.startswith('.') and os.path.isdir(os.path.join(dir, d)): yield d for subd in getdirs(os.path.join(dir, d)): yield subddirs(os.path.join(dir, d)): yield subd might do it. On Mon, Oct 26, 2009 at 3:32 PM, Benny Malengier <ben...@gm...> wrote: > Anybody time for a fun small coding gig? > > The problem? In src/gen/plug/_manager.py we go over all plugin > directories and register plugins with: > > for (dirpath, dirnames, filenames) in os.walk(direct): > > The problem? If you do a print of dirpath, you see that also .svn and > subdirs are scanned and added to pythonpath. This is not ok. > > The solution? The code should be a recursive algorithm I think, with > code to not descend into hidden directories (for linux, first char of > dir is .). > So handle one dir, then descend into non hidden directories. > > Also better for the user if hidden dirs in plugins are skipped > > Benny > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Gramps-devel mailing list > Gra...@li... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > -- Gerald Britton |