Lf2 ddlZddlmZmZddlmZmZmZddlm Z m Z ddl m Z ejeZd dZd dZdZd Zd Zy) N)environwalk)abspathisfilejoin)PopenPIPE) PUBLIC_DIR_REc#PKt|}t|ttfr|D]}t|D]}|yt |r|j |r|yt t|D]-\}}}|D]"}|j |st||$/yw)z6Generate *.py file names available in given directory.N) tuple isinstancelistfrom_directoryrendswithrrr)dname extensionsitemfnrootdirs file_namess %/usr/share/python3/debpython/files.pyrrsz"J%$'D$T*+ 5>>*5 &*75>&: "D$  ;;z*tR.(!';s BB&B&c#dKt|}tj}d|d<tdd|ftt|}|j \}}|j dk7rtd|z|jdd }|jD]}|j|s|y w) z4Generate *.py file names available in given package.zC.UTF-8LC_ALLz /usr/bin/dpkgz-L)stdoutstderrenvrzcannot get content of %szutf-8replace)errorsN) r rcopyrr communicate returncode Exceptiondecode splitlinesr) package_namerrprocessrrlines r from_packager).sz"J ,,.CCM_dL9$ $#/G((*NFFQ2\ABB ]]79] 5F!!# == $J$s B&B0)B0c#FK|D]}|j|s|yw)z4Generate *.py file names that match given directory.N) startswith)filesrrs rfilter_directoryr->s! == Hs!!c#Ktd|D}td|D}|D]8}tj|}|s|jd}||vs||vs5|:yw)z3Generate *.py file names that match given versions.c3&K|] }d|z yw)z%d.%dN.0is r z filter_public..Gs-Hqw{Hsc38K|]}t|dyw)rN)strr1s rr4z filter_public..Hs2Ac!A$isN)setr matchgroup)r,versionsvstr shared_vstrr public_dirverss r filter_publicr@Esf -H- -D222K"((, ##A&D{"ddl sAA%A%A%c#\Kt|}|D]}|j|r|yw)zrLsD*))"#g! )   rK