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 dejjZdS ) )absolute_import)unicode_literals)_loggerNc s e Zd ZdZdZeeZedZ fddZdd Z d d
Z
edd Zd
d Z
dd Zdd Zedd Zdd Zdd Zdd Zdd Z ZS )BuildDepCommandbuilddep build-depz3Install build dependencies for package or spec filez[PACKAGE|PACKAGE.spec]c s( t t| j| tjjj | _g | _d S )N) superr __init__dnfrpmZtransactionZinitReadOnlyTransaction_rpm_tstempdirs)selfcli) __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 ZpycompZurlparsepathlibdnfZrepoZ
DownloadertempfileZmkdtemposjoinbasenamer appendopenZdownloadURLbaseZconfZ_configfilenoRuntimeErrorclose)r pkgspeclocationZ
downloaderr Z temp_fileZtemp_foexr r r _download_remote_file8 s
z%BuildDepCommand._download_remote_filec C s dd }| j dddtdd | j dd d
g d|tdd
| j dddtdd | j }|j ddtdd |j ddtdd d S )Nc S s: | r| j d dng }t|dk r6td| }tj||S )N z&'%s' is not of the format 'MACRO EXPR')splitlenr argparseZArgumentTypeError)argZarglistmsgr r r macro_defR s
z0BuildDepCommand.set_argparser.