Sindbad~EG File Manager
3
�Pf�.�@sxdZddlmZddlZddlZddlZddlZddlZddlZddl m
Zddlm
Z
ddlZddlmZddlmZddlmZdd lmZdd
lmZdgZejdej�Zejd
�Zejejejej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*ej+ej,ej-ej.ej/ej0ej1gZ2ej3ej4ej5gZ6dd�e6D�Z7d dd�Z8dd�Z9d!dd�Z:dd�Z;dd�Z<dd�Z=dd�Z>dd�Z?dS)"z
Requirements file parsing
�)�absolute_importN)�parse)�filterfalse)�get_file_content)�InstallRequirement)�RequirementsFileParseError)�RemovedInPip10Warning)�
cmdoptions�parse_requirementsz^(http|https|file):z(^|\s)+#.*$cCsg|]}|�j�qS�)�dest)�.0�orr�/usr/lib/python3.6/req_file.py�
<listcomp>=srFccsp|dkrtd��t|||d�\}}t||�} x>| D]6\}
}t|||
||||||d� }x|D]
}
|
VqZWq2WdS)a�Parse a requirements file and yield InstallRequirement instances.
:param filename: Path or url of requirements file.
:param finder: Instance of pip.index.PackageFinder.
:param comes_from: Origin description of requirements.
:param options: cli options.
:param session: Instance of pip.download.PipSession.
:param constraint: If true, parsing a constraint file rather than
requirements file.
:param wheel_cache: Instance of pip.wheel.WheelCache
NzCparse_requirements() missing 1 required keyword argument: 'session')�
comes_from�session)�
constraint)� TypeErrorr�
preprocess�process_line)�filename�finderr�optionsrr�wheel_cache�_�content�
lines_enum�line_number�lineZreq_iter�reqrrrr
@s
cCs.t|j�dd�}t|�}t|�}t||�}|S)z�Split, filter, and join lines, and return a line iterator
:param content: the content of the requirements file
:param options: cli options
�)�start)� enumerate�
splitlines�
join_lines�ignore_comments�
skip_regex)rrrrrrras
rc cs
t�} | j�}
d|
_|r |j|
_t|�\}}tjdkr@|jd�}| jt j
|�|
�\}
}d|r`dnd||f}|r�|rz|jnd }|r�tj
||
�i}x.tD]&}||
jkr�|
j|r�|
j|||<q�Wtj||||||d
�V�n(|
j�r&|r�|jnd }|�r|jnd}tj|
jd|||||d�V�n�|
j�s6|
j�r�|
j�rN|
jd}d }n|
jd}d
}tj|��rvtj||�}n"tj|��s�tjjtjj|�|�}t|||||||d�} x| D]}|V�q�W�n>|
j �r�|
j |_ �n*|�r|
j!�r�t"j#dt$�|
j%�r
t"j#dt$�|
j&�rt"j#dt$�|
j�r0|
jg|_'|
j(d k�rPd |_(t)j*j+|j�|
j,d
k�rbg|_'|
j-�rx|j'j.|
j-�|
j/�r�|
j/d}tjjtjj0|��}tjj||�}tjj1|��r�|}|j/j2|�|
j3�r�d
|_4|
j5�r�d
|_5|
j6�r|j7j.dd�|
j6D��dS)a#Process a single requirements line; This can result in creating/yielding
requirements, or updating the finder.
For lines that contain requirements, the only options that have an effect
are from SUPPORTED_OPTIONS_REQ, and they are scoped to the
requirement. Other options from SUPPORTED_OPTIONS may be present, but are
ignored.
For lines that do not contain requirements, the only options that have an
effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may
be present, but are ignored. These lines may contain multiple options
(although our docs imply only one is supported), and all our parsed and
affect the finder.
:param constraint: If True, parsing a constraints file.
:param options: OptionParser options that we may update
N����utf8z%s %s (line %s)z-cz-rF)r�isolatedrrr)rr�default_vcsr,rT)rrz�--allow-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z�--allow-all-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z�--allow-unverified has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.css|]}d|dfVqdS)�*Nr)r
�hostrrr� <genexpr>�szprocess_line.<locals>.<genexpr>)r(r)r*)8�build_parserZget_default_values� index_urlZformat_control�break_args_options�sys�version_info�encode�
parse_args�shlex�splitZ
isolated_moder Zcheck_install_build_global�SUPPORTED_OPTIONS_REQ_DEST�__dict__rZ from_lineZ editablesr-Z
from_editable�requirements�constraints� SCHEME_RE�search�urllib_parseZurljoin�os�path�join�dirnamer
�require_hashes�allow_external�warnings�warnr�allow_all_externalZallow_unverifiedZ
index_urls� use_wheel�pip�indexZfmt_ctl_no_use_wheel�no_indexZextra_index_urls�extend�
find_links�abspath�exists�append�preZallow_all_prereleases�process_dependency_linksZ
trusted_hostsZsecure_origins)rrrrrrrrr�parserZdefaultsZargs_strZoptions_strZoptsrZline_comes_fromr,Zreq_optionsrr-Zreq_pathZnested_constraintr �valueZreq_dirZrelative_to_reqs_filerrrrns�
rcCsh|jd�}g}|dd�}x8|D]0}|jd�s8|jd�r<Pq |j|�|jd�q Wdj|�dj|�fS)z�Break up the line into an args and options string. We only want to shlex
(and then optparse) the options, not the args. args can contain markers
which are corrupted by shlex.
� N�-z--r)r9�
startswithrR�poprC)r�tokens�argsr�tokenrrrr3�s
r3cCsDtjdd�}tt}x|D]}|�}|j|�qWdd�}||_|S)z7
Return a parser for parsing requirement lines
F)Zadd_help_optioncSst|��dS)N)r)�self�msgrrr�parser_exitsz!build_parser.<locals>.parser_exit)�optparseZOptionParser�SUPPORTED_OPTIONS�SUPPORTED_OPTIONS_REQZ
add_option�exit)rUZoption_factoriesZoption_factoryZoptionr`rrrr1s
r1ccs�d}g}x�|D]x\}}|jd�s,tj|�rntj|�r>d|}|rb|j|�|dj|�fVg}q�||fVq|sv|}|j|jd��qW|r�|dj|�fVdS)z�Joins a line ending in '' with the previous line (except when following
comments). The joined line takes on the index of the first line.
N�\rW�)�endswith�
COMMENT_RE�matchrRrC�strip)rZprimary_line_numberZnew_linerrrrrr%"s
r%ccs8x2|D]*\}}tjd|�}|j�}|r||fVqWdS)z1
Strips comments and filter empty lines.
rfN)rh�subrj)rrrrrrr&?s
r&cs2|r
|jnd}|r.tj|��t�fdd�|�}|S)zs
Skip lines that match '--skip-requirements-regex' pattern
Note: the regex pattern is only built once
Ncs�j|d�S)Nr!)r?)�e)�patternrr�<lambda>Tszskip_regex.<locals>.<lambda>)Zskip_requirements_regex�re�compiler)rrr'r)rmrr'Js
r')NNNNFN)NNNNNF)@�__doc__Z
__future__rrAror8r4rarGZpip._vendor.six.moves.urllibrr@Zpip._vendor.six.movesrrKZpip.downloadrZpip.req.req_installrZpip.exceptionsrZpip.utils.deprecationrr �__all__rp�Ir>rhr=Zeditabler<rMr2rOZextra_index_urlrFrIZno_allow_externalZallow_unsafeZno_allow_unsaferJZno_use_wheelZalways_unzipZ no_binaryZonly_binaryrSrTZtrusted_hostrErbZinstall_optionsZglobal_options�hashrcr:r
rrr3r1r%r&r'rrrr�<module>sn
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists