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.