| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3.9/site-packages/cfnbootstrap/__pycache__/ |
Upload File : |
a
��0i� � @ sV d dl mZ d dlZd dlmZ d dlZe�d�ZG dd� de�Z G dd� de�Z
dS ) � )�
ProcessHelperN)� ToolErrorzcfn.initc @ s0 e Zd ZdZddd�Ze�d�Zedd� �Z dS ) �
PythonToolz$
Installs packages via pip
Nc s� g }|� � st�d� |S g }|D ]X� |� r<t|� t�rT|�t�� |� �� n|�� fdd�|� D �� |�� � q"t� d|� t
ddg| ��� }|jr�t�
d|j� td|j��nt� d |� t�d
|j� |S )aL
Install a set of packages via pip, returning the packages actually installed or updated.
Arguments:
action -- a dict of package name to version; version can be empty, a single string or a list of strings
Exceptions:
ToolError -- on expected failures (such as a non-zero exit code)
z No packages specified for pythonc 3 s | ]}t �� |�V qd S )N)r � _pkg_spec)�.0�ver��pkg� �C/usr/lib/python3.9/site-packages/cfnbootstrap/lang_package_tools.py� <genexpr>4 � z#PythonTool.apply.<locals>.<genexpr>z Attempting to install %s via pipZpip3�installzpip failed. Output: %sz.Could not successfully install python packageszpip installed %szpip output: %s)�keys�log�debug�
isinstance�str�appendr r �extend�infor �call�
returncode�error�stdoutr )�self�action�auth_config�pkgs_changedZpkgs�resultr
r r �apply s$
zPythonTool.applyz
^https?://.*$c C s( |s|S | j �|�� �r|S d||f S )Nz%s==%s)�_url_pattern�match�lower)�clsr r r
r
r r G s
zPythonTool._pkg_spec)N)
�__name__�
__module__�__qualname__�__doc__r �re�compiler! �classmethodr r
r
r
r r s
(
r c @ s. e Zd ZdZd dd�Zd
dd�Zddd�ZdS )�GemToolz)
Installs packages via rubygems
Nc C s� g }|� � st�d� |S |D ]h}d}|| s:| �|�}n>t|| t�rZ| �||| �}n|| D ]}| �||�rbd}qb|r|�|� q|S )aQ
Install a set of packages via rubygems, returning the packages actually installed or updated.
Arguments:
action -- a dict of package name to version; version can be empty, a single string or a list of strings
Exceptions:
ToolError -- on expected failures (such as a non-zero exit code)
zNo gems specifiedFT)r r r �_install_gemr r r )r r r r r Z installedr r
r
r r U s
z
GemTool.applyc C sT t �d||� ddddd| g}|r6|�dd| g� t|��� }|jrLd S d
S dS )z�"
Check to see if a package at version ver is installed.
If ver is not specified, just check for the package.
z-Checking to see if %s-%s is already installed�gem�queryz-iz-nz^%s$�-vz%sFTN)r r r r r r )r r r ZqueryCmdr r
r
r �_gem_is_installedw s zGemTool._gem_is_installedc C s� | � ||�rt�d||� dS t�d||� dddd|g}|rP|�dd | g� t|��� }|jr�t�d
|j� t d||f |j��n t�d||� t�
d
|j� dS dS )zbInstall a gem if the version is not already installed; return True if installed, False if skipped.z%%s-%s is already installed, skipping.Fz Installing %s version %s via gemr. r z-bz
--no-documentr0 z= %szGem failed. Output: %szFailed to install gem: %s-%szGem installed: %s-%szGem output: %sTN)r1 r r r r r r r r r r )r r r Zinstall_commandr r
r
r r- � s zGemTool._install_gem)N)N)N)r% r&