ó J¡Vc@sddlZddlZddlZddlZddlmZmZddlZddlTddl m Z m Z ddl m Z ejdejƒZejdejƒZdZd Zd ad ad „Zd d „Zdd„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Z dd„Z!d„Z"d„Z#d„Z$d„Z%d„Z&d „Z'd!„Z(d"„Z)d#„Z*d$„Z+dS(%iÿÿÿÿN(tPopentPIPE(t*(tutilstservices(t to_bytes_utf8s(\d+\.\d+\.\d+)s (\d+.\d+)iitcCsWtjdtjjtjdƒdƒdtƒ\}a|dkrStj dƒndS(Ns%s -ptldconfigt log_outputisldconfig failed.( RtruntostpathtjointwhichtFalset ld_outputtlogtdebug(tstatus((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytupdate_ld_output0s7 gcCs@tjd||fƒtj|ƒ\}}|dkrItjdƒtS|r+y|jƒd}Wntk r|d}nXtj|ƒtj|ƒ}y|j dƒ}Wnt k rÅd}nXyt |ƒ}Wnt k rêtSXtjd||fƒ||krtjdƒn||kSntjdƒt SdS( NsChecking: %s (min ver=%f)is Not found!RisVer=%f Min ver=%fs"Found, but newer version required.sFound.(RRRR Rt splitlinest IndexErrortver_pattsearchtgrouptAttributeErrortfloatt ValueErrortTrue(tcmdtmin_verRtoutputtlinet match_objtvertv_f((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyt check_tool8s4           cCsLtjd|ƒtj|ƒdkr7tjdƒtStjdƒtSdS(NsChecking for library '%s'...isFound.s Not found.(RRRtfindRR(tlibR((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyt check_lib\s   s /usr/includec Csltjd||fƒxAtj|dtdtdtd|ƒD]}tjd|ƒtSWtjdƒtS(Ns"Searching for file '%s' in '%s'...trecurset abs_pathstreturn_folderstpatternsFile found at '%s'sFile not found.(RRRt walkFilesRR(tftdirtw((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyt check_filejs . c Cs”tjd||fƒg}xItj|dtdtdtd|ƒD] }tj|ƒ|j|ƒqEW|rƒtjd|ƒn tjdƒ|S(Ns%Searching for file(s) '%s' in '%s'...R(R)R*R+sFound files: %ssNo files not found.(RRRR,RRtappend(R-R.tfoundR/((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyt locate_filests.  c Cs©tjd|||fƒg}x[tj|dtdtdtd|ƒD]2}t||ƒrHtj|ƒ|j|ƒqHqHW|r˜tjd|ƒn tjdƒ|S(sf Find a list of files located in a directory that contain a specified sub-string. s7Searching for file(s) '%s' in '%s' that contain '%s'...R(R)R*R+sFound files: %ssNo files not found.(RRRR,RRtcheck_file_containsR1(R-R.tsR2R/((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytlocate_file_contains‚s.  cCs°tjd||fƒzŠtjj|ƒrt|ƒ}xTt|dƒD]@}tƒ||krHtjd|jddƒ|fƒt SqHWntjdƒt SWdt ƒXdS(Ns'Checking file '%s' for contents '%s'...trbs'%s' found in file '%s'.s RsContents not found.( RRR R texistsRtopentupdate_spinnertreplaceRRtcleanup_spinner(R-R5ta((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyR4–s  #  cCs­|dk r tjd|ƒnz~xf|D]^}tƒtj|ƒ\}}|tkr*x)|D]!}tjd|||fƒq_WtSq*WtjdƒtSWdtƒXdS(Ns*Searching for '%s' in running processes...sFound: %s (%s)s Not found( tNoneRRR:RtIs_Process_RunningRRR<(t process_listtpRtprocess((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytcheck_ps©s     cCs¸i}|dk r´tjd|ƒzƒx||D]t}tƒtj|ƒ\}}|tkr”tjdt|ƒƒx,|D]}||||RRR:RR?RtlenR<(tprocess_name_listtprocesses_listRARt processestpid((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyt get_ps_pidºs     cCsUtsBtjdƒ}tjtjj|dƒdtƒ\}antj|ƒdkS(NtlsmodRi( t mod_outputRR R R R R RR%(tmoduleRJR((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyt check_lsmodÏs-s0.0cCs?tjd||fƒd}|dkr’tj|ƒ}y|jdƒ}Wntk rdd}nXyt|ƒ}Wq’tk rŽd}q’Xnd}|dkr tj|ƒ}y|jdƒ}Wntk rßd}nXyt|ƒ}Wq tk r d}q Xn||kr*tjdƒtStjdƒt SdS(Ns&Checking: installed ver=%s min ver=%sit-iRs"Found, but newer version required.sFound.( RRRRRRRRRR(t inst_ver_strt min_ver_strRR!R"tinst_ver((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyt check_versionØs8             RNcCs÷tjd|ƒtj|ƒ\}}|dkrCtjdƒ|Sy|jƒd}Wntk rpd}nXtj|ƒtj|ƒ}y|jdƒ}WnLt k rît j|ƒ}y|jdƒ}Wnt k ræ|SX|SnX|SdS(Ns Checking: %sis Not found!Ri( RRRR RRtver1_patRRRR(Rtdef_verRRR R!R"((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pyt get_versionûs*       cCsžy€ddl}d}y |j}WnZtk r~y/djg|jD]}t|ƒ^qEƒ}Wqtk rzd}qXnXWntk r™d}nX|S(NiÿÿÿÿRNt.(tdbust __version__RR tversiontstrt ImportError(RWt dbus_versiontx((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_python_dbus_vers   /   cCsZtjdƒd}yddl}Wntk r<d}nXddlm}|j}|S(NsChecking PyQt 4.x version...RNiÿÿÿÿ(tQtCore(RRtPyQt4R[R_tPYQT_VERSION_STR(R"R`R_((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_pyQt4_version&s    cCsIy,tjdƒddl}t|jƒ}Wntk r@dSX|SdS(NsTrying to import 'reportlab'...iÿÿÿÿRN(RRt reportlabRZtVersionR[(RcR"((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_reportlab_version3s   cCsŠtjdƒyddl}Wntk r1dSXy |j}Wntk r[|j}nXx#|jdƒdkr|d7}q_W|SdS(NsChecking PyQt 3.x version...iÿÿÿÿRNRVis.0(RRtqtR[RaRt PYQT_VERSIONtcount(Rft pyqtVersion((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_pyQt_version=s     cCsªd}y%tdddddgdtƒ}Wn d}nX|jƒdjd ƒ}|r¦tjd ƒ}|jƒd}|j|ƒr¦|j|ƒj d ƒ}q¦n|S( NRNtxsanes --versiont2t>s /dev/nulltstdoutisutf-8sxsane-(\d{1,}\.\d{1,}).*i( RRR>t communicatetdecodetretcompileRRR(t installed_vertp1Rt xsane_ver_pattxsane_ver_info((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_xsane_versionPs% cCs4yddlm}Wntk r(dSX|jSdS(Niÿÿÿÿ(tImageRN(tPILRxR[tVERSION(Rx((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_pil_versionas  cCsy(ddl}ddl}ddl}Wntk r<dSXyD|j|jjdƒ|jdt ƒ}|j |j _ |j ƒSWndSXdS(NiÿÿÿÿRNtc( tsystctypest ctypes.utilR[tCDLLtutilt find_libraryt DEFAULT_MODER>Rtc_char_ptgnu_get_libc_versiontrestype(R}R~tLIBC((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_libpthread_versionis( 'cCsXyddl}Wntk r$dSXdjg|jjjD]}t|ƒ^q;ƒSdS(NiÿÿÿÿRNRV(txml.parsers.expatR[R tparserstexpatt version_infoRZ(txmlR]((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_python_xml_versionws  cCstjS(N(tpropRY(((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_HPLIP_versionscCs-tjdddƒdkr%tdƒSdSdS(Nt configureslibusb01-buildtnotyesslibusb-config --versions1.0(tsys_conftgetRU(((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytget_libusb_versionƒs (,R tos.pathRqR}t subprocessRRtcodecstbase.gtbaseRRt base.sixextRRrt IGNORECASERSRtPIDtCMDLINERRKRR$R'R0R3R6R4RCRIRMRRRUR^RbReRjRwR{RˆRŽRR–(((s`/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/installer/dcheck.pytsH        $       #