?_."ddlZddlZddlZddlZddlmZddlZddlmZddl m Z m Z ejddk(rddlmZ dZ e ZeZnd Z d ZeZGd d eZy) N) guess_type)Cache) ClickPackage DebPackage)gettextc|SN)ss %/usr/share/gdebi/GDebi/GDebiCommon.pypy3utf8r(sc>ttj|Sr )utf8r strs r_r-sGOOC())rcft|tr|S t|dS#t|dcYSxYw)NzUTF-8latin1) isinstanceunicoders rpy2utf8r1s7 c7 #J *3( ( *3) )s 0cLeZdZd dZdZd dZdZdZdZdZ dZ d Z d Z y ) GDebiCommoncd|_d|_d|_d|_d|_d|_||_g|_g|_d|_ y)Nr) cprogress_cachedepsversion_info_titleversion_info_msg_deb_optionsinstallremoveunauthenticated)selfdatadiroptionsfiles r__init__zGDebiCommon.__init__?sK  "$ "     rct|j|_|jjjdkDr!t d|_t d|_yy)NrzBroken dependencieszYour system has broken dependencies. This application can not continue until this is fixed. To fix it run 'gksudo synaptic' or 'sudo apt-get install -f' in a terminal window.FT)rrr _depcache broken_countr error_header error_bodyr)s r openCachezGDebiCommon.openCacheKsQDNN+ ;; - - 1 !"7 8D !89DO rcntjj|}t}|j drt } |||j ||_y#tttf$r}tjd|zt|}|ddk7rS|ddk7rKtdtjj|z|_td|dz|_Yd}~ytdtjj|z|_td |_Yd}~yd}~wwxYw) Nz.clickzopen failed with %srz%application/vnd.debian.binary-packagez'%s' is not a Debian packagezKThe MIME type of this file is '%s' and can not be installed on this system.FzCould not open '%s'zjThe package might be corrupted or you are not allowed to open the file. Check the permissions of the file.)ospathabspathrendswithrr r$IOError SystemError ValueErrorloggingdebugrrbasenamer1r2)r)r, downloadedklassemimetypes ropenzGDebiCommon.openXswwt$ == " E dDKK-?D)&@=  333==S]]%?%?./1(/)D+,-/>-?D)&@=4/2P,i(  s #FF.-F.ct}t} |j|jjj}|r|jr6|jjD]}|D]}|j|dt|jj|}|rt|jjD]}|j|js|j|jjD]=}|jD],}|j|vs|j|j.?|Sy#t t f$rd}Y'wxYw)Nr)setr r$rJ installedrKrLprovidesadd differencelistkeys dependenciesor_dependenciesname) r)rXbroken_providesrSpipackagedepds rcompareProvideszGDebiCommon.compareProvidessM5% ++dii//0::C ||+++A+ QqT*++3<<(33H=H#DKK$4$4$67@G{{7+55#';;w#7#A#A#N#N@C%(%8%8@#$66X#5$3$7$7$?@@@ # " )$ C s-EE+*E+ctjjtjj|jj }|j |jjj}tjj|j }|jrtj|tjsd}tjjtjj||s|j||j!tjj||dyy)Nz/tmpT)r6r7r8dirnamer$filenamer rJrNr?rOaccessW_OKexistsjoin fetch_binaryrD)r)rhrcrJs rdownload_packagezGDebiCommon.download_packages''//"''//$))2D2D"EF++dii//0::''""7#3#34   99Wbgg. 77>>"'',,w"@A$$W- IIbggll7G4d ; rc|jj\|_|_|_d|_t |jt |jcxk(rdk(rnntd|_t |jdkDr4|xj tdt |jzz c_t |jdkDr4|xj tdt |jzz c_y)NrrzAll dependencies are satisfiedz+Requires the removal of %s packages z(Requires the installation of %s packagesT)r$required_changesr&r'r(r!lenrr3s r get_changeszGDebiCommon.get_changess<@IIrsg.  A!$ DG** Dd&dr