Mi ddlZddlZddlZddlZddlmZmZmZddlm Z dZ dZ dZ Gdde ZGd d eZd Zd Zd e ee eefffdZdZdS)N)STDOUTCalledProcessError check_output)Dictz"/usr/share/l.v.e-manager/cl.pythonz alt-pythonz/opt/alt/pythonceZdZdZdS) PythonErrorz9Top level error class for admin's part of Python selectorN__name__ __module__ __qualname____doc__W/opt/cloudlinux/venv/lib64/python3.11/site-packages/clselect/clselectpython/__init__.pyrrsCCDrrceZdZdZdS)PythonConfigErrorz$Generic error class for PythonConfigNr rrrrrs..Drrc tjtdS#t$r!}|jtjkrYd}~dSd}~wwxYw)N)osmakedirs CONFIG_DIROSErrorerrnoEEXIST)es rcreate_config_dirsr!sb J  7el " "  # " " " " "s AAAcbt|tsdStjd|sdSdS)z>Return True if specified MAJOR version is valid for processingFz ^\d+\.\d+$T) isinstancestrrematch)vers ris_major_versionr")s7 c3  u 8M3 ' 'u 4rreturnci}tjtdD]0}tj|}dt tj|}t|dkrc|dd|dd}tj|dd |}tj |s t|d gd t }| }t|dkr|d}||d ||<!#t$rY.wxYw|S)z Search CloudLinux Python interpreters and return information about them. Returns: Dictionary mapping major Python versions (e.g., "2.7", "3.9") to dictionaries containing the full version and root path. *r.Nbinpythonz-VT)textstderr) full_version root_path)globALT_PYTHON_PREFIXrpathbasenamejoinfilterrisdigitlenisfilerrstripsplitr) resultalt_python_folder folder_nameversion_digitsmajor_minor_version python_binfull_version_outputpartsfull_vers rscan_python_versionsrD2stF!Y*;'>'>'>??##g&&'899  [!A!ABB ~   " " "0!2II^ABB5GIIW\\"3UrJs ??????????2  %     )           /d3S#X#67////d r