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.