ó +¢µRc@s”ddlZddlmZddlmZmZmZddlmZm Z ej e ƒZ d d„Z d d„Zd„Zd „Zd „ZdS( iÿÿÿÿN(twalk(tabspathtisfiletjoin(tPopentPIPEs.pyccsÏt|ƒ}t|ttfƒrQx§|D]"}xt|ƒD] }|Vq;Wq(Wnzt|ƒrt|j|ƒrt|VnWxTtt|ƒƒD]@\}}}x.|D]&}|j|ƒrt||ƒVqqWq‡WdS(s6Generate *.py file names available in given directory.N( ttuplet isinstancetlisttfrom_directoryRtendswithRRR(tdnamet extensionstitemtfntroottdirst file_names((s$/usr/share/python/debpython/files.pyR s  " ccsŽt|ƒ}td|dtdtƒ}|jƒ\}}|jdkr\td|ƒ‚nx+|jƒD]}|j|ƒri|VqiqiWdS(s4Generate *.py file names available in given package.s/usr/bin/dpkg -L %stshelltstdoutiscannot get content of %sN( RRtTrueRt communicatet returncodet Exceptiont splitlinesR (t package_nameR tprocessRtstderrtline((s$/usr/share/python/debpython/files.pyt from_package.s  ccs,x%|D]}|j|ƒr|VqqWdS(s4Generate *.py file names that match given directory.N(t startswith(tfilesR R((s$/usr/share/python/debpython/files.pytfilter_directory;s ccsUtd„|Dƒƒ}x8|D]0}|jdƒr|dd!|kr|VqqWdS(s3Generate *.py file names that match given versions.css|]}d|VqdS(s%d.%dN((t.0ti((s$/usr/share/python/debpython/files.pys Dss/usr/lib/pythoniiN(tsetR(Rtversionst versions_strR((s$/usr/share/python/debpython/files.pyt filter_publicBs  ccs,x%|D]}|j|ƒs|VqqWdS(s<Removes files with matching extensions from given generator.N(R (RR R((s$/usr/share/python/debpython/files.pytfilter_out_extKs (s.py(s.py(tloggingtosRtos.pathRRRt subprocessRRt getLoggert__name__tlogR RR R&R'(((s$/usr/share/python/debpython/files.pyts