jg(zddlmZddlmZddlmZddlZddlmZddlmZm Z m Z m Z m Z m Z Gdd eZdS) )print_function)division)absolute_importN)BasePkgManager)scan_python_versionsis_major_version CONFIG_DIRcreate_config_dirs ALT_NAMESALT_PYTHON_PREFIXceZdZdZdZeZdZeZ dZ d ede de gZ d ede de gZ d Zd Zd Zd Zd ZdZedZdS) PkgManagerz Class responsible for all interactions with Yum, python version installation/removal and gathering info about already installed versions c"tdSN)r selfs Y/opt/cloudlinux/venv/lib64/python3.11/site-packages/clselect/clselectpython/pkgmanager.py_create_config_dirszPkgManager._create_config_dirssz)LANG=C yum --disableplugin=fastestmirror z!&>/var/log/cl-python-last-yum.logz -y install z{} z -y remove ctSr)rrs r_scan_interpreter_versionsz%PkgManager._scan_interpreter_versions?s#%%%rcdtd|ddzS)Nz{}/.lock.r)r formatreplacerversions r_get_lock_file_pathzPkgManager._get_lock_file_pathBs2 :#4#4 OOC $ $$&$&& &rc|}|s|dStjd|}d|D}|S)a Should return list of major versions available to install from currently enabled repos. Note, this can be an empty list if no NodeJS version has been released to repos yet or in case of network/repos/yum problem. OR None if our cache is updating right now because it was absent/outdated/corrupted/etc. :rtype: list | None Nzalt-python(\d+)cXg|]'}d|d|ddg(S)rrrN)join).0rs r z1PkgManager.checkout_available..Zs5RRRWSXXwqz7122;788RRRr)_read_yum_cacheupdate_yum_cacherefindall)rdata availables rcheckout_availablezPkgManager.checkout_availableFs_##%%   ! ! # # #4J0$77 RR RRR rc~t|sd|S|}|r|SdS)z5Do some common pre-installation/uninstallation checksz>Invalid version "{}". It should be two digits separeted by dotN)r r_check_yum_in_progress)rr working_errors r_verify_actionzPkgManager._verify_action]sR(( N>>DfWoo N3355  !  ! !rc^|j|ddS)z Formatting cmd string for install package :return: formatted cmd string :param version: version of interpreter for installing :rtype: str rr) _install_cmdrrrs r format_cmd_string_for_installingz+PkgManager.format_cmd_string_for_installingfs) ''R(@(@AAArc^|j|ddS)z Formatting cmd string for removing package :return: formatted cmd string :param version: version of interpreter for removing :rtype: str rr) _remove_cmdrrrs rformat_cmd_string_for_removingz)PkgManager.format_cmd_string_for_removingps)&&wsB'?'?@@@rcLddlm}|}||S)zJ Check what passed version isn't used any web-application r)ApplicationsManager)$clselect.clselectpython.apps_managerr8is_version_in_use)rr8 apps_managers r_is_version_in_usezPkgManager._is_version_in_usezs9 MLLLLL**,, --g666rN)__name__ __module__ __qualname____doc__rr _config_dir_yum_cmdr _alt_names _redirect_logr#r2r5rr r,r0r3r6 staticmethodr<rrrrs K;HJ7M77E L''E K&&&&&&.!!!BBBAAA77\777rr) __future__rrrr( clselect.baseclselect.pkgmanagerrrrr r r r r rrFrrrIs&%%%%%&&&&&& ;;;;;;k7k7k7k7k7k7k7k7k7k7r