관리-도구
편집 파일: builddep.cpython-36.opt-1.pyc
3 �f�$ � @ 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 d d � Z edd� �Zd d� Z dd� Zdd� Zedd� �Zdd� Zdd� Zdd� Zdd� Z� ZS )�BuildDepCommand�builddep� build-depz3Install build dependencies for package or spec filez[PACKAGE|PACKAGE.spec]c s( t t| �j|� tjjj� | _g | _d S )N) �superr �__init__�dnf�rpmZtransactionZinitReadOnlyTransaction�_rpm_ts�tempdirs)�self�cli)� __class__� �/usr/lib/python3.6/builddep.pyr / s zBuildDepCommand.__init__c C s x| j D ]}tj|� qW d S )N)r �shutilZrmtree)r �temp_dirr r r �__del__4 s zBuildDepCommand.__del__c C s� t jjj|�}|d dkr |jS tjj� }tjdd�}t jj |t jj|��}| jj |� t|d�}zFy|j| jjj||j� � W n$ tk r� } z� W Y dd}~X nX W d|j� X |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 r )r ZpycompZurlparse�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� }|j ddtd�d� |j ddtd�d� d S )Nc S s: | r| j d d�ng }t|�dk r6td�| }tj|��|S )N� � z&'%s' is not of the format 'MACRO EXPR')�split�lenr �argparseZArgumentTypeError)�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 z'MACRO EXPR'z$define a macro for spec file parsing)�action�defaultr6 �typer7 z--skip-unavailable� store_trueFz5skip build dependencies not available in repositories)r8 r9 r7 z--specz)treat commandline arguments as spec files)r8 r7 z--srpmz)treat commandline arguments as source rpm)�add_argumentr Zadd_mutually_exclusive_group)�parserr1 Zptyper r r � set_argparserP s zBuildDepCommand.set_argparserc C s | j jsd| j _d S )N�error)�optsZrpmverbosity)r r r r � pre_configuref s zBuildDepCommand.pre_configurec C sr | j j}d|_d|_d|_d|_| jjp.| jjsnx<| jj D ]0}|j d�pZ|j d�pZ|j d�s:| jjj � P q:W d S )NTz.src.rpmz .nosrc.rpmz.spec)r �demandsZavailable_reposZ resolvingZ root_userZsack_activationr@ �spec�srpmr2 �endswithr"