HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/LanguageSelector/__pycache__/LangCache.cpython-38.pyc
U

ڀR];�@s�ddlmZddlZe�dde�ddlZddlZGdd�de�ZGdd�de�Z	Gd	d
�d
e
�ZGdd�dej�Z
ed
kr�ddlmZdZede�Ze
eej���Zed�ed�dd�e��D���dS)�)�print_functionN�ignorezapt API not stable yetc@seZdZdd�Zdd�ZdS)�LanguagePackageStatuscCs"||_||_d|_d|_d|_dS)NF)�languageCode�pkgname_template�	available�	installed�doChange)�selfrZpkg_template�r�</usr/lib/python3/dist-packages/LanguageSelector/LangCache.py�__init__
s
zLanguagePackageStatus.__init__cCs(d|j|jt|j�t|j�t|j�fS)NzZLanguagePackageStatus(langcode: %s, pkgname %s, available: %s, installed: %s, doChange: %s)rr�strrrr	�r
rrr�__str__s�zLanguagePackageStatus.__str__N)�__name__�
__module__�__qualname__r
rrrrrr	src@sNeZdZddd�Zedd��Zedd��Zedd	��Zed
d��Zdd
�Z	dS)�LanguageInformationNcCs\||_||_i|_t|d�|jd<|j��D]*}|j|}||k|_|jr,||j|_q,dS)Nzlanguage-pack-%sZlanguagePack)	r�language�languagePkgListr�valuesrrZis_installedr)r
�cacherrZlangpkg_status�pkgnamerrrr
s

zLanguageInformation.__init__cCs|js|jsdSdS)zK returns True if only parts of the language support packages are installed TF)�notInstalled�
fullInstalledrrrr�inconsistent)sz LanguageInformation.inconsistentcCs:|j��D]*}|jsq
|jr"|jr
|js.|js
dSq
dS)zM return True if all of the available language support packages are installed FT�rrrrr	�r
�pkgrrrr.sz!LanguageInformation.fullInstalledcCs:|j��D]*}|jsq
|js"|jr
|jr.|js
dSq
dS)zN return True if none of the available language support packages are installed FTrrrrrr5sz LanguageInformation.notInstalledcCs |j��D]}|jr
dSq
dS)zM returns true if anything in the state of the language packs/support changes TF)rrr	rrrr�changes<szLanguageInformation.changescCsd|j|jfS)Nz%s (%s))rrrrrrrBszLanguageInformation.__str__)NN)
rrrr
�propertyrrrr rrrrrrs




rc@seZdZdS)�ExceptionPkgCacheBrokenN)rrrrrrrr"Fsr"c@s@eZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
S)�LanguageSelectorPkgCachecCs6tj�||�|jjdkr t��||_t�|�|_	dS)Nr)
�apt�Cacher
�	_depcacheZbroken_countr"�_localeinfo�language_support_pkgsZLanguageSupport�lang_support)r
Z
localeinfo�progressrrrr
Ks
z!LanguageSelectorPkgCache.__init__cCsb|jjD]T}|jD]H}|�d��d�r(q|�d��d�r:q|jdkrFq|jr|jrdSqqdS)z, verify that a network package lists exists �zcdrom:zhttp://security.ubuntu.comzDebian Package IndexTF)Z_list�listZindex_filesZarchive_uri�
startswithZlabel�existsZhas_packages)r
Z	metaindexZ	indexfilerrr�havePackageListsRs

z)LanguageSelectorPkgCache.havePackageListscCs|j��dS)z clear the selections N)r&Zinitrrrr�clearaszLanguageSelectorPkgCache.clearcCsHg}g}|��D].}|js |jr,|�|j�|jr|�|j�q||fS)N)Zget_changesZmarked_installZmarked_upgrade�append�nameZ
marked_delete)r
Zto_instZto_rmrrrr�getChangesListesz'LanguageSelectorPkgCache.getChangesListc	Cs�|j��D]�\}}|jr
|jj|j|jd�}zR|jrf|D]*}|�d�sV|�d|j�r8||�	�q8n|D]}||�
�qjWq
tk
r�t��Yq
Xq
dS)z$ commit changed status of list items)rzlanguage-pack-�-N)
r�itemsr	r)Z	by_localerrr-�endswithZmark_deleteZmark_install�SystemErrorr")r
�li�key�itemZpkgsrrrr�tryChangeDetailsos
�z)LanguageSelectorPkgCache.tryChangeDetailscCsRg}|jj��D]<\}}|dkr"qt|||�}dd�|j��D�r|�|�q|S)z5 returns a list with language packs/support packages ZzhcSsg|]}|jr|�qSr)r)�.0�srrr�
<listcomp>�szCLanguageSelectorPkgCache.getLanguageInformation.<locals>.<listcomp>)r'Z_langr5rrrr1)r
�res�codeZlangr8rrr�getLanguageInformation�sz/LanguageSelectorPkgCache.getLanguageInformationN)
rrrr
r!r/r0r3r;rArrrrr#Is

r#�__main__)�
LocaleInfoz/usr/share/language-selectorZlanguagelistzavailable language informationz, cCsg|]}d|�qS)z%sr)r<�xrrrr>�sr>)Z
__future__r�warnings�filterwarnings�
FutureWarningr$r(�objectrr�	Exceptionr"r%r#rrCZdatadirr8r*Z
OpProgressZlc�print�joinrArrrr�<module>s/H