/usr/lib/python3/dist-packages/DistUpgrade/__pycache__
NameSizeModeActions
apt_btrfs_snapshot.cpython-310.pyc93400644editdlrm
apt_clone.cpython-310.pyc222920644editdlrm
dist-upgrade.cpython-310.pyc2780644editdlrm
distro.cpython-310.pyc147090644editdlrm
DistUpgradeApport.cpython-310.pyc37340644editdlrm
DistUpgradeCache.cpython-310.pyc355350644editdlrm
DistUpgradeConfigParser.cpython-310.pyc30060644editdlrm
DistUpgradeController.cpython-310.pyc540930644editdlrm
DistUpgradeFetcher.cpython-310.pyc37880644editdlrm
DistUpgradeFetcherCore.cpython-310.pyc91910644editdlrm
DistUpgradeFetcherKDE.cpython-310.pyc65270644editdlrm
DistUpgradeFetcherSelf.cpython-310.pyc12960644editdlrm
DistUpgradeGettext.cpython-310.pyc20290644editdlrm
DistUpgradeMain.cpython-310.pyc60550644editdlrm
DistUpgradePatcher.cpython-310.pyc18640644editdlrm
DistUpgradeQuirks.cpython-310.pyc462210644editdlrm
DistUpgradeVersion.cpython-310.pyc1770644editdlrm
DistUpgradeView.cpython-310.pyc148250644editdlrm
DistUpgradeViewGtk3.cpython-310.pyc262760644editdlrm
DistUpgradeViewKDE.cpython-310.pyc302080644editdlrm
DistUpgradeViewNonInteractive.cpython-310.pyc114330644editdlrm
DistUpgradeViewText.cpython-310.pyc109400644editdlrm
GtkProgress.cpython-310.pyc25810644editdlrm
MetaRelease.cpython-310.pyc94720644editdlrm
QUrlOpener.cpython-310.pyc19450644editdlrm
ReleaseNotesViewer.cpython-310.pyc50150644editdlrm
ReleaseNotesViewerWebkit.cpython-310.pyc20580644editdlrm
SimpleGtk3builderApp.cpython-310.pyc17590644editdlrm
SimpleGtkbuilderApp.cpython-310.pyc17320644editdlrm
telemetry.cpython-310.pyc29790644editdlrm
utils.cpython-310.pyc151910644editdlrm
xorg_fix_proprietary.cpython-310.pyc30700644editdlrm
__init__.cpython-310.pyc1470644editdlrm
Edit: /usr/lib/python3/dist-packages/DistUpgrade/__pycache__/utils.cpython-310.pyc (15191B)
o {fmH@sBddlmZddlmZddlmZddlmZmZmZddl m Z ddl Z ddl Z e ddlZddlZddlZddlZddlZddlZddlZzddlmZmZmZmZmZddlmZWney}ddlmZmZmZmZmZddlmZYnwdd l m Z Gd d d e!Z"Gd d d Z#ddZ$ddZ%dMddZ&ddZ'dNddZ(ddZ)ddZ*ddZ+d d!Z,d"d#Z-d$d%Z.Gd&d'd'eZ/dMd(d)Z0dMd*d+Z1d,d-Z2d.d/Z3d0d1Z4d2d3Z5dMd4d5Z6d6d7Z7dMd8d9Z8dMd:d;Z9dd?Z;d@dAZdFdGZ?dHdIZ@eAdJkre:ddKdLdSdS)O)print_function)gettext)ngettext)S_IMODEST_MODES_IXUSR)ceilN) ProxyHandlerRequest build_openerinstall_openerurlopen)urlsplit)copyc@s*eZdZdZd ddZddZddZd S) ExecutionTimez Helper that can be used in with statements to have a simple measure of the timing of a particular block of code, e.g. with ExecutionTime("db flush"): db.flush() cCs ||_dSN)info)selfrr3/usr/lib/python3/dist-packages/DistUpgrade/utils.py__init__Gs zExecutionTime.__init__cCst|_dSr)timenowrrrr __enter__JszExecutionTime.__enter__cCs td|jt|jfdS)Nz%s: %s)printrrr)rtypevaluestackrrr__exit__Ms zExecutionTime.__exit__N)r)__name__ __module__ __qualname____doc__rrr rrrrr@s   rc@s(eZdZdZdZdZdZdZdZdZ dS) SoftwarePropertiesPagerN) r!r"r#ubuntu_softwareother_softwareupdatesauthenticationadditional_driversdeveloper_options ubuntu_prorrrrr%Qsr%cCsJt|}t|j}|jr|j|jd|_|jr!|j|jd|_t|S)Nzhidden-uzhidden-p)rruriusernamereplacepasswordstr)entrytmp url_partsrrr)get_string_with_no_auth_from_source_entry[s r;cCsDd}zddl}|}|d}W|Sty!tdY|Sw)z+ return True if Unity is currently running FrNzcom.canonical.Unityz&could not check for Unity dbus service)dbus SessionBusname_has_owner Exceptionlogging exception) unity_runningr<busrrris_unity_runninges  rDcCs|st}|dkrId|}t| }|}Wdn1s!wY|dddd}||kr8dSt|ddd}|dks dS) Nrz /proc/%s/stat(r')Tr&F)osgetpidopenread partition rpartitionintsplit) processnamepid stat_filestat_fstatcommandrrris_child_of_process_nameqs   rUcCs0tjdr tjdsdStdtdkS)z, returns True if we are inside a chroot z/procz/proc/1T/z /proc/1/root)rGpathexistsrSrrrr inside_chrootsrYFrcCsLd}|D]}t||dt||kr|d|7}||d7}q|S)z helpers inspired after textwrap - unfortunately we can not use textwrap directly because it break packagenames with "-" in them into new lines r  )rNlenrfind)twidthsubsequent_indentoutsrrrwraps   rdcKs8d}|d}|D]}t|fi|}||d7}q |S)Nrr[)rNrd)rckwargsmsgparasparrrrtwraps  ricCsdg}tjds gStjdgtjdd}|dd}|d=|D] }|r/||dq"|S)z= return list of loaded modules (or [] if lsmod is not found) z /sbin/lsmodTstdoutuniversal_newlinesrr[) rGrWrX subprocessPopenPIPE communicaterNappend)modulesplineslinerrrlsmods  rvcCsFtj|sdStt|t}|t@tks!t||tBdSdS)zB check if a given binary has the executable bit and if not, add itN)rGrWrXrrSrrchmod)rWmoderrrcheck_and_fix_xbits  rycCsddi}dtjvr dStjd}|dd|vr"||ddSd|vrA|dddd }d |vr=|d d}|dS|dd dS) z: helper to get the country mirror from the current locale crLANGNr*_.rr&@r')rGenvironlowerrN) lang_mirrorlangcountryrrrcountry_mirrors rcCtjd}|rtd||Sddlm}m}|gd|dd}|}|dkr4t j d|d S|j }|j |S) z2 return the codename of the current runing distro META_RELEASE_FAKE_CODENAMEzQusing fake release name '%s' (because of META_RELEASE_FAKE_CODENAME environment) rrnro) lsb_releasez-c-sTrj"lsb_release returned exitcode: %i unknown distributionrGrgetr@warningrmrnrowaitsysstderrwriterkreadlinestripclose)distrnrorsresrrrget_dist"   rcCr) z2 return the version of the current running distro META_RELEASE_FAKE_VERSIONzSusing fake release version '%s' (because of META_RELEASE_FAKE_VERSION environment) rr)rz-rrTrjrrr)descrnrorsrrrrget_dist_versionrrc@seZdZddZdS) HeadRequestcCdS)NHEADrrrrr get_methodszHeadRequest.get_methodN)r!r"r#rrrrrrs rc CsT|sdd|d|t|\}}}}}|d|||||f|dvrSztt|}||jdkr7WdSWdStyR}z |d |WYd }~dSd }~ww|d krd d l} z1| |} | | t j || t j |} | |r|d | | d krWdSWdSty}z|r|d|WYd }~dSd }~wwdS)z helper that checks if the given uri exists and is downloadable (supports optional debug_func function handler to support e.g. logging) Supports http (via HEAD) and ftp (via size request) cSr)NTr)xrrr sz"url_downloadable..zurl_downloadable: %sz"s='%s' n='%s' p='%s' q='%s' f='%s')httphttpsTFzerror from httplib: '%s'Nftprzftplib.size() returned: %szerror from ftplib: '%s')rr rrcoder?ftplibFTPlogincwdrGrWdirnamesizebasenamequit) r3 debug_funcschemenetlocrWquerryfragment http_fileerfrrrrurl_downloadablesP        rc CsBd}i}tjddkrtjd|d<n0tj|rEt}t|||dd}|rE|d}t | d}|rE|rEd ||f|d<tjd dkrVtjd |d <n d|vr`|d|d <|r| D]}t d |sztd |tjddSqft|}t|} t| d|vrtd|dd |vrtd|d |S)z init proxy settings * use apt.conf http proxy if present, * otherwise look into synaptics config file, * otherwise the default behavior will use http_proxy environment if present z/root/.synaptic/synaptic.confzAcquire::http::ProxyrrzSynaptic::useProxyFzSynaptic::httpProxyzSynaptic::httpProxyPortz http://%s:%s/zAcquire::https::Proxyrz https?://\w+zproxy '%s' looks invalid)fileN http_proxy https_proxy)apt_pkgconfigfindrGrWrX Configurationread_config_filefind_br7find_ivaluesrematchrrrr r r putenv) gsettingsSYNAPTIC_CONF_FILEproxiescnf use_proxy proxy_host proxy_portproxy proxy_supportopenerrrr init_proxy,s>       rc CszOddl}||jj}z|dd}||d}|ddWWS|jjyO}z!d}|j|kr2|dd }||d}|dd WYd}~WSd}~wwt yYYd Sw) z Check via dbus if the system is running on battery. This function is using UPower per default, if UPower is not available it falls-back to DeviceKit.Power. rNzorg.freedesktop.UPowerz/org/freedesktop/UPowerzorg.freedesktop.DBus.Properties OnBatteryz)org.freedesktop.DBus.Error.ServiceUnknownzorg.freedesktop.DeviceKit.Powerz /org/freedesktop/DeviceKit/Power on_batteryF) r<Bus TYPE_SYSTEM get_object InterfaceGet exceptions DBusException_dbus_error_namer?)r<rCdevobjdevr error_unknownrrrrXs.    rc Cszz2ddlm}m}||jj}|dddd|ddd dd d d \}}|j| |dd }|WSt y<Yd Sw) z Send a dbus signal to logind to not suspend the system, it will be released when the return value drops out of scope r)GioGLibzorg.freedesktop.login1z/org/freedesktop/login1zorg.freedesktop.login1.ManagerInhibitz(ssss))zshutdown:sleep UpdateManagerzUpdating SystemblockN)fdF) gi.repositoryrr bus_get_syncBusTypeSYSTEMcall_with_unix_fd_list_syncVariantUnixInputStream steal_fdsr?)rr connectionvarfdlist inhibitorrrr inhibit_sleepts   rcCs|dks |dkr dSdS)N0FALSEFT)upper)r7rrr str_to_boolsrcCs:ddl}z t\}}|WSty|dYdSw)Nrzgedefaultlocale() failed)r@localegetdefaultlocaler?rA)r@locale_sencodingrrrget_langs   rcCst|d}|dddS)z6 try to guess the flavor based on the running desktop cache-r&r)get_ubuntu_flavor_packagerN)rpkgrrrget_ubuntu_flavors rcCs ddlm}|d}|ddS)Nr)DistUpgradeConfigz"/usr/share/ubuntu-release-upgraderDistroMetaPkgs)#DistUpgrade.DistUpgradeConfigParserrgetlist)rparserrrr_load_meta_pkg_lists  rc Csdg}z |ttWnty$}z td|WYd}~nd}~ww|dur-t}|D]}||vr9||nd}|rD|jrD|Sq/dS)zB try to guess the flavor metapackage based on the running desktop zubuntu-desktopz%Could not load list of meta packages:N)extendsortedrr?raptCache is_installed)r meta_pkgsrmeta_pkg cache_pkgrrrrs rcCsbt|d}ddi}||vr||S|dr t|dddS|dr/t|dddSdS) z; try to guess the flavor name based on the running desktop rzubuntustudio-desktopz Ubuntu Studioz-desktopr&rz-netbookUbuntu)rendswithcapitalize_first_wordrsplit)rrlookuprrrget_ubuntu_flavor_names   rcCsddl}|ddddlm}m}|j||jj|jj |j j d}| d||f| ||jj|d||dS) NrGtkz3.0)rGdk)parentflagsrbuttonsz%s %srF)girequire_versionrrr MessageDialog DialogFlagsMODAL MessageTypeERROR ButtonsTypeCLOSE set_markuprealize get_window set_functions WMFunctionMOVE set_titlerundestroy)rsummarymessagerrrdrrrerrors  r1cCsH|dkrtt|td}tdd|d|iSttd|ddS)zG Convert a given size in bytes to a nicer better readable unit i@Biz %(size).0f kBrz%.1f MBg@@)rMrfloatrr format_stringr|)bytes size_in_kbrrr humanize_sizes  r6cCs tjdS)NzAPT::Architecture)rrrrrrrget_archs r7c Csd}d}d}td?}|D]1}|}|sq|}||}||kr%q||dd}t|d} | |kr@WddSqWdd S1sLwYd S) z@ check if the current system is listening on the given tcp port r&r(0Az /proc/net/tcp:NTF)rI readlinesrrNrM) portINDEX_LOCAL_ADDR INDEX_STATESTATE_LISTENINGnet_tcprurstatelocal_port_str local_portrrris_port_already_listenings.    rDcCsVd}tdkr tdtjdsdStjddgtjdd d}||kr)dSdS) z# Return True if iptables is active zChain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination rz%Need root to check the iptables statez/sbin/iptablesFiptablesz-nLTrj) rGgetuidOSErrorrWrXrmrnrorp)iptables_emptyrbrrriptables_actives   rIcCs@t|dkr|dr|ds|d|ddS|S)z3 this uppercases the first word's first letter r&rN)r]isalphaisupper capitalize)stringrrrr,s$rcCst|jdd}t|S)zX this takes a package synopsis and uppercases the first word's first letter r.r)getattr candidater)rnamerrrget_package_label4srQ__main__barbazr)rZr)B __future__rrr|rrSrrrmathrr r init_configrr@rrGrmrrurllib.requestr r r r r urllib.parser ImportErrorurllib2urlparserobjectrr%r;rDrUrYrdrirvryrrrrrrrrrrrrrrr1r6r7rDrIrrQr!rrrrsr              +,