관리-도구
편집 파일: builddep.cpython-39.opt-1.pyc
a �&c�$ � @ s� d dl mZ d dl mZ d dlmZmZ d dlZd dlZd dlZd dl Zd dl Zd dlZd dlZ d dlZd dlZd dlZd dlZejjG dd� dejj��ZdS )� )�absolute_import)�unicode_literals)�_�loggerNc s� e Zd ZdZdZee�Zed�Z� fdd�Zdd� Z dd � Z ed d� �Zdd � Z dd� Zdd� Zedd� �Zdd� Zdd� Zdd� Zdd� Z� ZS )�BuildDepCommand)Zbuilddepz build-depz3Install build dependencies for package or spec filez[PACKAGE|PACKAGE.spec]c s( t t| ��|� tjj�� | _g | _d S �N) �superr �__init__�dnf�rpmZtransactionZinitReadOnlyTransaction�_rpm_ts�tempdirs)�self�cli�� __class__� �8/usr/lib/python3.9/site-packages/dnf-plugins/builddep.pyr / s zBuildDepCommand.__init__c C s | j D ]}t�|� qd S r )r �shutil�rmtree)r �temp_dirr r r �__del__4 s zBuildDepCommand.__del__c C s� t jj�|�}|d dv r |jS tj�� }tjdd�}t j� |t j�|��}| j� |� t|d�}zPz|�| jjj||�� � W n& ty� } z� W Y d}~n d}~0 0 W |�� n |�� 0 |S )z� In case pkgspec is a remote URL, download it to a temporary location and use the temporary file instead. r )�file� Z dnf_builddep_)�prefixzwb+N)r Zpycomp�urlparse�path�libdnfZrepoZ Downloader�tempfileZmkdtemp�os�join�basenamer �append�openZdownloadURL�baseZconfZ_config�fileno�RuntimeError�close)r �pkgspec�locationZ downloaderr Z temp_fileZtemp_fo�exr r r �_download_remote_file8 s z%BuildDepCommand._download_remote_filec C s� dd� }| j dddtd�d� | j dd d g d|td�d � | j dddtd�d� | �� }|j ddtd�d� |j ddtd�d� d S )Nc S s: | r| � d d�ng }t|�dk r6td�| }t�|��|S )N� � z&'%s' is not of the format 'MACRO EXPR')�split�lenr �argparse�ArgumentTypeError)�argZarglist�msgr r r � macro_defR s z0BuildDepCommand.set_argparser.<locals>.macro_def�packages�+�packagez"packages with builddeps to install)�nargs�metavar�helpz-Dz--definer"