JVc@sddlmZdZdZdZdZddlZddlZddlZddl Z ddl m Z m Z ddl m Z dd l Tdd lmZmZmZmZdd lTdd lmZeZydd lmZmZWnek rejd nXeZeddefdeddefejdddefdddefdddefejej ej!ej"ej#ej$dddefdddefdddefdddefgZ%e j&dZ'dZ(d Z)d!Z*d"Z+d#Z,d$Z-d%d&Z.d'Z/d(Z0d)Z1d*e2fd+YZ3e4d,kryej5eyDejej6dd-d.d/d0d1d2d3d4d5d6d7g \Z7Z8Wn:ej9k rZ:ej;e:j<e.ej=dnXd8Z>ej?d9rd:Z>ne@ZAeZBeZCxze7D]r\ZDZEeDd;d<fkr2e.nJeDd=krKe.d>n1eDd?krde.d@neDdAkreFedBdCej=dDneDdEdFfkreEjGjHZ>neDdGkrd:Z>neDdHkreZCneDdIdJfkreIZAneDdKdLdMfkreJZAnbeDdNdOfkr5e@ZAnGeDdPkrgejKejLdQej=dneDdRkr|eZBnq WejMe> re.neC rejNnejOjPdSZQejKejLdTeQejOjReQr%yejSeQWn"eTk r!ejKdUeQnXnejUeQeB rLejVejWnejVejXe/eYjZdVdWZ[e3e\e]e[Z^e^j_e^j`eAeB\ZaZbeapebre^jcnejKejddXWneek rej;dYnXejKejKdZndS([i(tprint_functions15.1s Dependency/Version Check Utilityshp-checksyChecks dependency versions,permissions of HPLIP. (Run as 'python ./check.py' from the HPLIP tarball before installation.)N(tPY3tto_string_utf8(R(t*(tutilsttuitqueuest smart_install(tcups(tdevicetpmlsDevice library is not avail.ttnamesUsage: %s [OPTIONS]tsummarysCompile-time check:s-c or --compiletoptionsRun-time check:s-r or --run or --runtimesCompile and run-time checks:s-b or --both (default)sb1. For checking for the proper build environment for the HPLIP supplied tarball (.tar.gz or .run),tnotes%use the --compile or --both switches.sc2. For checking for the proper runtime environment for a distro supplied package (.deb, .rpm, etc),suse the --runtime switch.s FUNC#(.*)iiiiitnottextcCsI|dkrtjttntjt|ttttjddS(NRi( Rt log_titlet __title__t __version__t format_texttUSAGEt__mod__tsystexit(ttyp((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytusageQs cCstjtttjtjdx$tjdD]}tj|q6Wx$tjdD]}tj|q]Wx$tjdD]}tj|qWtjx$tjdD]}tj|qWx$tjdD]}tj|qWx$tjdD]}tj|qWx$tjdD]}tj|q*Wx$tjd D]}tj|qQWx$tjd D]}tj|qxWtjtjd tjd tjd tjdtjdS(Ns)Note: hp-check can be run in three modes:s1. Compile-time check mode (-c or --compile): Use this mode before compiling the HPLIP supplied tarball (.tar.gz or .run) to determine if the proper dependencies are installed to successfully compile HPLIP.s2. Run-time check mode (-r or --run): Use this mode to determine if a distro supplied package (.deb, .rpm, etc) or an already built HPLIP supplied tarball has the proper dependencies installed to successfully run.s3. Both compile- and run-time check mode (-b or --both) (Default): This mode will check both of the above cases (both compile- and run-time dependencies).s Check types:s&a. EXTERNALDEP - External DependenciessMb. GENERALDEP - General Dependencies (required both at compile and run time)s*c. COMPILEDEP - Compile time Dependenciessd. [All are run-time checks]s PYEXT SCANCONF QUEUES PERMISSIONs Status Types:s OKs? MISSING - Missing Dependency or Permission or Plug-insE INCOMPAT - Incompatible dependency-version or Plugin-version( RRRRtlogtinfotboldRtformat_paragraph(tl((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pyt show_titleZs6      cCsF|tks|dkr>|dks3t||r7dSdSndSdS(Nit-tOKtINCOMPATtMISSING(tTruet check_version(t Installedststmin_vert Installed_ver((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pyt Status_Type~s cCswd}|dks|dkrp|dkrst|d rRt|drRd}qmt|dsmd}qmqsn|d kr|dkrd }qsd }n|d ks|d ks|dkr|dkrsd}qsn|dkr|dkrd}qsd}ns|dkr0tdkr0|dkrsd}qsnC|dkrZ|dkrQd}qsd}n|dkrsd|}n|S(NR"tpyqttpyqt4R#s2.3s2.2s/Fax is not supported if version is lessthan 2.3s>Python Programming is not supported if version is lessthan 2.2thpaios%'hpaio found in /etc/sane.d/dll.conf'sP'hpaio not found in /etc/sane.d/dll.conf. hpaio needs to be added in this file.'tcupsexttpcardextthpmudexts5'Not Found or Failed to load, Please reinstall HPLIP'Rs*'CUPS may not be installed or not running's'CUPS Scheduler is running'tlibusbtyess"'libusb-1.0 needs to be installed'tdbuss*'DBUS may not be installed or not running's'%s needs to be installed'(R'tIS_LIBUSB01_ENABLED(tpackaget Inst_statust installed_vertcomment((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pyt get_comments8      $              tDependenciesCheckcBseZeeddZdZdZdZdZdZ dZ dZ d Z d Z eed Zd ZRS( tqt4cCs}tj||||d|_d|_||_t|_g|_g|_g|_ i|_ d|_ g|_ d|_ dS(NiR (t CoreInstallt__init__t num_errorst num_warnst ui_toolkittFalsetdisable_selinuxtreq_deps_to_be_installedtopt_deps_to_be_installedtcmds_to_be_runtcomm_error_devicest plugin_statustsmart_install_devicest user_grps_cmd(tselftmodetui_modeRA((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pyR>s          c Cs|dkr|jtkrdS|jdkrM|jdkrM|dkrMdS|dkrl|jdkrldS|dkr|jdkrdS|dkr|j rdS|jdkrd|jkr|d#krdSn|ddkrd}nVtj|dr5|d|j kr,|j |d}qEd}nt |d}t |d|d|}t |||}gg}}|j r|j|\}}| r|dkr|j|qn;|j||\}}| r|dkr|j|n|drd} nd} |dkr`|dksCt|dr`t|_tjd|n|dkr|dkrt|_n|dkrtjd||d | |d|||fntjtjd!||d | |d|||f|jd"7_x'|D]} | r|jj| qqW| dkrjxT|D]} | rD|jj| qDqDWn*x'|D]} | rq|jj| qqqqWdS($Nscups-ddkR<tqt3R,R-R.trhels5.R4s python-devels python-dbuss pyqt4-dbusslibnetsnmp-develtgcctmaket reportlabt policykits sane-develiR"iiitREQUIREDtOPTIONALRs1.4s6cups -ddk not required as cups version [%s] is => 1.4 R1R#s' %-20s %-60s %-15s %-15s %-15s %-10s %sis. error: %-13s %-60s %-15s %-15s %-15s %-10s %si( sdbuss python-devels python-dbuss pyqt4-dbusslibnetsnmp-develRPRQRRRSs sane-develscups-ddk(tcups_ddk_not_reqR&RAtscanning_enabledt distro_nametdistro_versiontNonet Ver_Func_Pattsearcht version_funct get_versionR+R:tis_auto_installer_supporttget_dependency_datatappendR'Rtdebugthpmudext_availRtredR?RFRERD( RKt sup_dist_verstdt deps_infoR8tStatusR9tpackages_to_installtcommandst package_typetcmdtpkg((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pyt__update_deps_infosh*       '   17    cCs|jS(N(RD(RK((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytget_required_depsscCs|jS(N(RE(RK((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytget_optional_depsscCs|jS(N(RF(RK((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytget_cmd_to_run scCs|jS(N(RC(RK((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytget_disable_selinux_statusscCs|jS(N(RG(RK((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytget_communication_error_devsscCs|jS(N(RJ(RK((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytget_user_grp_cmdscCs|jS(N(RH(RK((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytget_plugin_statusscCs|jS(N(RI(RK((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytget_smart_install_devices#scM Cst|_t|_tjdd|_tj}|rLtjtj ntjddd}|j d}|j }|j |krt |r|t |d}tj tjd|j|j |j|fntjdtjd \}}tjd \}} tjd \}} tjd || | |j|j ftjd tjtjd tjdd} | rFtjdd} tjd| tjd| |jrtjd|j|j fntj d|j|j ftjtjtjdytddj} Wn<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|jd7_tjd`q |j!d7_!tj daq ||*jYkr |j!d7_!|*jY|_Wtj dbq n|dkr y|jWn)tFk r% }tj|jZdC},nX|j[},tjC|,|,sq tjdd||j\|<|jd7_q tjden~|dfkr y|j]t^j_\}-},WntFk r nX|,s tjdd||j\|<|jd7_q tjdenWd|dk r|j`nXntjqRWqAtj dgntjdh|jrtj/di}.|.rtjjG|.di}.tjdj|.\}} | rt:j;dkt:j<}/tjC| yd\dla}0Wn-tbk rtjdl|jd7_nXx| j>D]}1tM}2|/j?|1}|dk r|jc\}}3}4}5}6|0jd||3\}7}8|7|0jekrtJ|8}8d}yt3jL|8dddtM}WntFk rqnX|jfsqqntjCdmqtgjh}9d}x*|9D]"}|ji|8kr|jj}PqqWtjjGdndodpd9||3}:tjjH|:sxtjjGdndqdpd9||3}:ntjjH|:rtjk|:\ };}<}=}>}?}@}A}B}C}Dtj/drtM}E|Ertjds|E|:f\}} | jldt}FdC}Gxv|FD]n}Hdr|Hkr dC|Hk r du|Hkr t:j;dv}I|Ij?|Hrx|Gdw|Ij?|Hj@d}Gqxq q Wtjdxdy|dzdDdDd{d||:|Gffqtjdxdy|dzdDdDd{d}|:|;d~@ffqqqWqqnd}JtjjH|Jrtjdyt|Jd}KWn"tk rRtjd|JqXx\|KD]T}Lt:jmddC|L}L|LdkrZ|j!d7_!tj ddtM|_nPqZqZW|jntkrtjddqntojp|_qt |jqrbtjd|jd7_x.|jqD] }tjd|ddfqWqbntjd|jd7_|rxtj|n|j|j!fS(Nt configures ui-toolkitslibusb01-buildRt versions_listisZ%s-%s version is not supported. Using %s-%s versions dependencies to verify and install...s SYSTEM INFOsuname -r -v -osuname -ns1 Kernel: %s Host: %s Proc: %s Distribution: %s %ss Bitness: %s bit sHPLIP CONFIGURATIONthpliptversiontdirsthomesHPLIP-Version: HPLIP %ssHPLIP-Home: %ssMHPLIP-Installation: Auto installation is supported for %s distro %s version sQHPLIP-Installation: Auto installation is not supported for %s distro %s version s.Current contents of '/etc/hp/hplip.conf' file:s/etc/hp/hplip.conftrs4Could not access file: %s. Check HPLIP installation.s3Current contents of '/var/lib/hp/hplip.state' file:s/var/lib/hp/hplip.states4Plugins are not installed. Could not access file: %ss/Current contents of '~/.hplip/hplip.conf' file:s~/.hplip/hplip.confsCould not access file: %ss scanner-buildt0s' %-20s %-20s %-10s %-10s %-10s %-10s %sss ss sss s External Dependenciesis General Dependenciess COMPILEDEPs Python Extentionss Scan Configurations Other DependenciessDISCOVERED SCANNER DEVICESt scanimages scanimage -Lis#Failed to get Scanners information.sNo scanners were identifiedsNo Scanner found.sDISCOVERED USB DEVICEStusbs Device URItModelsNo devices found.sINSTALLED CUPS PRINTER QUEUESs (\S*): (.*)s lpstat -vis cups-pdf:/sipp://R R"tUnknownthpfaxtFaxthptPrintersType: %ssDevice URI: %ss /etc/cups/ppds.ppdsPPD: %ss\*NickName:\s*\"(.*)"trbsFailed to read %s ppd filesPPD Description: %ss lpstat -p%ssPrinter status: %ss sHP FaxsNIncorrect PPD file for fax queue '%s'. Fax queues must use 'HP-Fax-hplip.ppd'.sXIncorrect PPD file for a print queue '%s'. Print queues must not use 'HP-Fax-hplip.ppd'.s`Printer is not HPLIP installed. Printers must use the hp: or hpfax: CUPS backend for HP-Devices.sDevice initialization failed.tplugini(t pluginhandlers"Required plug-in status: Installeds"Optional plug-in status: Installeds&Required plug-in status: Not installeds&Optional plug-in status: Not installeds plug-in status: Version mismatchtparsCommunication status: FailedsCommunication status: GoodtnetsNo queues found.t PERMISSIONtlsusbs %s -d03f0:sd^Bus\s([0-9a-fA-F]{3,3})\sDevice\s([0-9a-fA-F]{3,3}):\sID\s([0-9a-fA-F]{4,4}):([0-9a-fA-F]{4,4})(.*)sfNOT FOUND OR FAILED TO LOAD! Please reinstall HPLIP and check for the proper installation of hpmudext.s Device URI: (Makeuri FAILED)t/tdevtbustproctgetfacls%s %ss tfiles.*:(.*)t s#%-15s %-30s %-15s %-8s %-8s %-8s %stUSBtRequiredR#sNode:'%s' Perm:'%s'sNode:'%s' Mode:'%s'is/etc/selinux/configtSELINUXsFailed to open %s file.s\ssSELINUX=enforcings#%-12s %-12s %-10s %-3s %-3s %-8s %stSELinuxtenabledtOptionalR$sI'SELinux needs to be disabled for Plugin printers and Fax functionality.'s#%-15s %-15s %-10s %-3s %-3s %-8s %stdisableds)'CD-ROM'/'Smart Install' Detected Devicess%-30s %-20s %s tCD_ROM_EnabledsNeeds to disable Smart InstallsHPLIP not found.(ss ss sss (s Device URIR(RR(RR(RRRR"R"sINCOMPATsI'SELinux needs to be disabled for Plugin printers and Fax functionality.'(RRRR"R"sOKR"(rRBRVRctsys_conftgetRARt get_wheret set_wheret LOG_TO_FILEtget_distro_dataRYtlentwarnRRXRtheaderRtrunRt getBitnessR_topentreadtIOErrortOSErrorterrortstrerrorR?tostpatht expanduserR@tto_boolRWt dependenciestupdatethplip_dependenciestDEPENDENCY_RUN_AND_COMPILE_TIMEtDEPENDENCY_RUN_TIMEt EXTERNALDEPt$_DependenciesCheck__update_deps_infot GENERALDEPt COMPILEDEPtPYEXTtSCANCONFtwhicht device_availtpropt usb_buildR t probeDevicest Formattertlisttitemstaddtoutputtretcompilet IGNORECASERZt splitlinesR\tgroupRatAttributeErrorRbt startswithtparseDeviceURItErrortjointexistst MULTILINERtreplacetDeviceR&tmqt PLUGIN_NONEtPLUGIN_REQUIREDtPLUGIN_OPTIONALt installerRt PluginHandlet getStatustPLUGIN_INSTALLEDRHtPLUGIN_NOT_INSTALLEDtPLUGIN_VERSION_MISMATCHtmsgt getDeviceIDRGtgetPMLR t OID_DEVICE_IDtcloseR1t ImportErrortgroupst make_usb_urit HPMUD_R_OKt supportedRt getPrinterst device_uriR tstattsplittsubRCRt get_smartinstall_enabled_devicesRI(MRKt time_flagt is_quiet_modetorg_log_locationR5tvrstsupported_distro_vrstStst Kernel_infot Host_infot Proc_infotvR|RtetdeptstatustdevicestfRftddt lpstat_patt cups_printerst plugin_ststptmatcht printer_nameRtback_endtis_hpRtmodeltserialtdev_filethosttzctporttxtppdt nickname_pattdescRRt pluginObjtdeviceidt error_codeRt lsusb_patR1totokRtvidtpidtmfgt result_codet deviceuritprinterstdevnodetst_modetst_inotst_devtst_nlinktst_uidtst_gidtst_sizetst_atimetst_mtimetst_ctimeRtgetfacl_out_listtouttgtpatt selinux_filet selinux_fptline((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytvalidate's^    #        %  % ! ! ! ! ! ! $               . @                                            !$- $*3G        $ cCsKtjdtjtjdtjtjdtdt|jdkrhtjdnKxH|jD]=}|dkrtjd||fqrtjd|qrWtjd tjtjd tjtjdtd t|jdkrtjd n%x"|jD]}tjd|q%W|j t ks^|j t krtjd tjtjd tjtjdtd tjd n|j t krtjd tjtjdtjtjdtdtjdn|jrtjd tjtjdtjtjdtdx"|jD]}tjd|qiWtj\}}tjtjd|ntjd tjd|jtjd|jtj|j s7|j t ks7|j t ks7t|js7t|jrGtjdndS(NtSUMMARYsMissing Required DependenciesR"iRZRs7'%s' package is missing or '%s' service is not running.s%'%s' package is missing/incompatible R sMissing Optional DependenciessNone sPlug-in StatussPlug-ins need to be installedRsSELINUX need to be disableds$SMART INSTALL/CD_ROM ENABLED DEVICESs%ssSmart Install is enabled for these devices. Please disable Smart Install to enable device functionalities. Refer link '%s' to disable Smart Install. sTotal Errors: %dsTotal Warnings: %ds6Run 'hp-doctor' command to prompt and fix the issues. (RRRRRRRDRRERHRRRCR&RIRtget_SmartInstall_tool_infoR?R@(RKRiRturlt tool_name((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pytdisplay_summarysP              E(t__name__t __module__t MODE_CHECKtINTERACTIVE_MODER>RRoRpRqRrRsRtRuRvRRBR/R4(((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pyR;s A        t__main__s hl:gtcrbsithelps help-restshelp-mans help-descslogging=RtruntimeRtbothtfixRt HPLIP_DEBUGRbs-hs--helps --help-resttrests --help-mantmans --help-desctendRis-ls --loggings-gs-ts-cs --compiles-rs --runtimes--runs-bs--boths--fixsI Note:- 'hp-check --fix' is deprecated. Please run 'hp-doctor' command s-ss./hp-check.logsSaving output in log file: %ssFailed to remove %s fileRws ui-toolkitsNo errors or warnings.s User exitsDone.(ft __future__RRRRt__doc__RRtgetoptRt base.sixextRRtbase.gtbaseRRRRtinstaller.core_installtprntRRBRR R RRRbR&t USAGE_OPTIONStUSAGE_LOGGING1tUSAGE_LOGGING2tUSAGE_LOGGING3tUSAGE_LOGGING_PLAINt USAGE_HELPt USAGE_NOTESRRR[RRRRRR5RR!R+R:R=R;R5t set_moduletargvtoptstargst GetoptErrorRRRRt log_leveltgetenvRRRtfmtRtatprinttlowertstriptDEPENDENCY_COMPILE_TIMERRRt set_levelt no_formattingRtabspathtlog_fileRtremoveRt set_logfileRtLOG_TO_CONSOLE_AND_FILERRRRAR7R8tcoretinitR/R?R@R4tgreentKeyboardInterrupt(((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/check.pyts     "   $ &c  D