관리-도구
편집 파일: util.cpython-36.pyc
3 �ft`�O � @ sv d dl mZ d dl mZ d dl mZ ddlmZmZ d dlmZm Z d dl Z d dlZd dlZd dl Zd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZejd�Ze j � j!d kr�e j � j!ndZ"e"j#� Z$d d� Z%d^dd �Z&d_dd�Z'dd� Z(dd� Z)dd� Z*dd� Z+dd� Z,dd� Z-dd� Z.dd � Z/d!d"� Z0d#d$� Z1d%d&� Z2d'd(� Z3d)d*� Z4d+d,� Z5d-d.� Z6d/d0� Z7d1d2� Z8d3d4� Z9d5d6� Z:d7d8� Z;d9d:� Z<d;d<� Z=d=d>� Z>d?d@� Z?dAdB� Z@dCdD� ZAd`dFdG�ZBdHdIejCfdJdK�ZDdLdM� ZEdNdO� ZFdPdQ� ZGdRdS� ZHG dTdU� dUeI�ZJG dVdW� dWeK�ZLG dXdY� dYeM�ZNdZd[� ZOd\d]� ZPdS )a� )�print_function)�absolute_import)�unicode_literals� )�PY3� basestring)�_�ucdN�dnfZyumc C s� t | dg � t | dg � t | dg � t� }x�|D ]�}||kr>q0|j|� tjjj|�d }|jd�rr| jj|� q0|r�|d kr�| jj|� q0|j d �r�| j j|dd� � q0| jj|� q0W dS )a� Categorize :param values list into packages, groups and filenames :param namespace: argparse.Namespace, where specs will be stored :param values: list of specs, whether packages ('foo') or groups/modules ('@bar') or filenames ('*.rmp', 'http://*', ...) To access packages use: specs.pkg_specs, to access groups use: specs.grp_specs, to access filenames use: specs.filenames � filenames� grp_specs� pkg_specsr z.rpm�http�ftp�file�https�@r N)r r r r )�setattr�set�addr �pycompZurlparse�endswithr �append� startswithr r )� namespace�valuesZtmp_set�valueZschemes� r �/usr/lib/python3.6/util.py�_parse_specs7 s r c C s� |d krt jj� }t jj| ||�}tjj|j�r6|jS t |j g�}|jd|� |j� g}yt jjjt jj|�d� W nB tk r� } z&|jr�tt|���tjt|�� W Y d d }~X nX |jS )Nr T)r �callbackZNullDownloadProgress�repoZRemoteRPMPayload�os�path�existsZ local_path�sumZ download_size�startZ_librepo_target�libdnfZ PackageTargetZdownloadPackagesZVectorPPackageTarget�RuntimeError�strict�IOError�str�logger�error)�url�confZprogressZploadZest_remote_sizeZtargets�er r r �_urlopen_progressW s r1 �w+bc K s� t rd|kr|jdd� tj|f|�}y<|r@|jj| |j� � n tjj j |rR|jnd| |j� � W n. tk r� } zt t|���W Y dd}~X nX |jd� |S )z| Open the specified absolute url, return a file object which respects proxy setting even for non-repo downloads �b�encodingzutf-8Nr )r � setdefault�tempfileZNamedTemporaryFileZ_repoZdownloadUrl�filenor'