o
    hf                     @   s  d Z ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZmZmZm Z m!Z!m"Z"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z) ddlm*Z* dd Z+G dd dZ,G dd de,eZ-G dd deZG dd deZ.dd Z/dd Z0dd Z1d d! Z2d"d# Z3d$d% Z4d&d' Z5d(d) Z6d3d+d,Z7d-d. Z8d/d0 Z9G d1d2 d2e*Z:dS )4zUsetuptools.command.egg_info

Create a distribution's .egg-info directory and contents    )FileList)DistutilsInternalError)convert_path)logN)Command)sdist)walk_revctrl)edit_config)	bdist_egg)parse_requirements	safe_nameparse_versionsafe_versionyield_lines
EntryPointiter_entry_pointsto_filename)glob)	packaging)SetuptoolsDeprecationWarningc                 C   s  d}|  tjj}ttj}d|f }t|D ]\}}|t|d k}|dkr8|r/|d7 }n|d||f 7 }qd}t|}	||	k r|| }
|
dkrQ||d 7 }n|
d	krZ||7 }nx|
d
kr|d }||	k rp|| dkrp|d }||	k r~|| dkr~|d }||	k r|| dkr|d }||	k r|| dks||	kr|t|
7 }n0||d | }d}|d dkrd}|dd }|t|7 }|d|f 7 }|}n|t|
7 }|d7 }||	k sB|s||7 }q|d7 }tj|tj	tj
B dS )z
    Translate a file path glob like '*.txt' in to a regular expression.
    This differs from fnmatch.translate which allows wildcards to match
    directory separators. It also knows about '**/' which matches any number of
    directories.
     z[^%s]   **z.*z
(?:%s+%s)*r   *?[!]^Nz[%s]z\Z)flags)splitospathsepreescape	enumeratelencompile	MULTILINEDOTALL)r   patchunksr#   
valid_charcchunk
last_chunki	chunk_lencharinner_iinner
char_class r7   W/var/www/html/olx_land/venv/lib/python3.10/site-packages/setuptools/command/egg_info.pytranslate_pattern#   s\   


-r9   c                   @   s@   e Zd ZdZdZedd Zdd Zdd Zdd	 Z	ee	Z
dS )

InfoCommonNc                 C   s   t | j S N)r   distributionget_nameselfr7   r7   r8   namez   s   zInfoCommon.namec                 C   s   t | | j S r;   )r   
_maybe_tagr<   get_versionr>   r7   r7   r8   tagged_version~   s   zInfoCommon.tagged_versionc                 C   s    | j r|| j r|S || j  S )z
        egg_info may be called more than once for a distribution,
        in which case the version string already contains all tags.
        )vtagsendswithr?   versionr7   r7   r8   rA      s   zInfoCommon._maybe_tagc                 C   s,   d}| j r
|| j 7 }| jr|td7 }|S )Nr   z-%Y%m%d)	tag_buildtag_datetimestrftimerF   r7   r7   r8   tags   s   
zInfoCommon.tags)__name__
__module____qualname__rH   rI   propertyr@   rC   rA   rL   rD   r7   r7   r7   r8   r:   v   s    

r:   c                   @   s   e Zd ZdZg dZdgZddiZdd Zedd Z	e	j
d	d Z	d
d Zdd ZdddZdd Zdd Zdd Zdd Zdd ZdS )egg_infoz+create a distribution's .egg-info directory))z	egg-base=ezLdirectory containing .egg-info directories (default: top of the source tree))tag-datedz0Add date stamp (e.g. 20050528) to version number)z
tag-build=bz-Specify explicit tag to add to version number)no-dateDz"Don't include date stamp [default]rS   rV   c                 C   s"   d | _ d | _d | _d | _d| _d S )NF)egg_baseegg_namerQ   egg_versionbroken_egg_infor>   r7   r7   r8   initialize_options   s
   
zegg_info.initialize_optionsc                 C      d S r;   r7   r>   r7   r7   r8   tag_svn_revision      zegg_info.tag_svn_revisionc                 C   r]   r;   r7   )r?   valuer7   r7   r8   r^      r_   c                 C   s0   t  }|  |d< d|d< t|t|d dS )z
        Materialize the value of date into the
        build tag. Install build keys in a deterministic order
        to avoid arbitrary reordering on subsequent builds.
        rH   r   rI   )rQ   N)collectionsOrderedDictrL   r	   dict)r?   filenamerQ   r7   r7   r8   save_version_info   s   zegg_info.save_version_infoc              
   C   sL  | j | _|  | _t| j}zt|tjj}|rdnd}t	t
|| j| jf  W n tyB } ztjd| j| jf |d }~ww | jd u rV| jj}|pOi dtj| _| d t| jd | _| jtjkrstj| j| j| _d| jv r||   | j| jj_| jj}|d ur|j| j kr| j|_t| j|_ d | j_d S d S d S )Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%sr   rX   	.egg-info-)!r@   rY   rC   rZ   r   
isinstancer   rG   Versionlistr   
ValueError	distutilserrorsDistutilsOptionErrorrX   r<   package_dirgetr!   curdirensure_dirnamer   rQ   r"   joincheck_broken_egg_infometadata_patched_distkeylower_version_parsed_version)r?   parsed_version
is_versionspecrR   dirspdr7   r7   r8   finalize_options   sH   






zegg_info.finalize_optionsFc                 C   sR   |r|  ||| dS tj|r'|du r |s td|| dS | | dS dS )a  Write `data` to `filename` or delete if empty

        If `data` is non-empty, this routine is the same as ``write_file()``.
        If `data` is empty but not ``None``, this is the same as calling
        ``delete_file(filename)`.  If `data` is ``None``, then this is a no-op
        unless `filename` exists, in which case a warning is issued about the
        orphaned file (if `force` is false), or deleted (if `force` is true).
        Nz$%s not set in setup(), but %s exists)
write_filer!   r"   existsr   warndelete_file)r?   whatrd   dataforcer7   r7   r8   write_or_delete_file   s   	zegg_info.write_or_delete_filec                 C   sB   t d|| |d}| jst|d}|| |  dS dS )zWrite `data` to `filename` (if not a dry run) after announcing it

        `what` is used in a log message to identify what is being written
        to the file.
        zwriting %s to %sutf-8wbN)r   infoencodedry_runopenwriteclose)r?   r   rd   r   fr7   r7   r8   r   
  s   


zegg_info.write_filec                 C   s$   t d| | jst| dS dS )z8Delete `filename` (if not a dry run) after announcing itzdeleting %sN)r   r   r   r!   unlink)r?   rd   r7   r7   r8   r     s   zegg_info.delete_filec                 C   s   |  | j t| jd  | jj}tdD ]}|j|d | }|| |j	tj
| j|j	 qtj
| jd}tj
|rC| | |   d S )Nzegg_info.writers)	installerznative_libs.txt)mkpathrQ   r!   utimer<   fetch_build_eggr   requireresolver@   r"   rs   r   r   find_sources)r?   r   epwriternlr7   r7   r8   run  s   
zegg_info.runc                 C   s4   t j| jd}t| j}||_|  |j| _dS )z"Generate SOURCES.txt manifest filezSOURCES.txtN)	r!   r"   rs   rQ   manifest_makerr<   manifestr   filelist)r?   manifest_filenamemmr7   r7   r8   r   -  s
   
zegg_info.find_sourcesc                 C   sX   | j d }| jtjkrtj| j|}tj|r*td|| j	 | j	| _
|| _	d S d S )Nrf   aB  ------------------------------------------------------------------------------
Note: Your current .egg-info directory has a '-' in its name;
this will not work correctly with "setup.py develop".

Please rename %s to %s to correct this problem.
------------------------------------------------------------------------------)rY   rX   r!   rq   r"   rs   r   r   r   rQ   r[   )r?   beir7   r7   r8   rt   5  s   

zegg_info.check_broken_egg_infoNF)rM   rN   rO   descriptionuser_optionsboolean_optionsnegative_optr\   rP   r^   setterre   r   r   r   r   r   r   rt   r7   r7   r7   r8   rQ      s&    



1rQ   c                   @   s|   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd ZdS )r   c              	   C   s  |  |\}}}}| j| j| j| jt| j|t| j|| j	| j
d}dddddddd	d}z|| }W n tyD   td
j|dw |d}	|dv rQ|g}|	rV|fnd}
|| }| d|g|	rg|gng  |  |D ]}||stj||g|
R   qpd S )N)includeexcludezglobal-includezglobal-excludezrecursive-includezrecursive-excludegraftprunez%warning: no files found matching '%s'z9warning: no previously-included files found matching '%s'z>warning: no files found matching '%s' anywhere in distributionzRwarning: no previously-included files matching '%s' found anywhere in distributionz:warning: no files found matching '%s' under directory '%s'zNwarning: no previously-included files matching '%s' found under directory '%s'z+warning: no directories found matching '%s'z6no previously-included directories found matching '%s'z/this cannot happen: invalid action '{action!s}')actionz
recursive->   r   r   r7    )_parse_template_liner   r   global_includeglobal_exclude	functoolspartialrecursive_includerecursive_excluder   r   KeyErrorr   format
startswithdebug_printrs   r   r   )r?   liner   patternsdirdir_pattern
action_maplog_mapprocess_actionaction_is_recursiveextra_log_argslog_tmplpatternr7   r7   r8   process_template_lineH  sf   

zFileList.process_template_linec                 C   sR   d}t t| jd ddD ]}|| j| r&| d| j|   | j|= d}q|S )z
        Remove all files from the file list that match the predicate.
        Return True if any matching files were removed
        Fr   z
 removing T)ranger'   filesr   )r?   	predicatefoundr1   r7   r7   r8   _remove_files  s   zFileList._remove_filesc                 C   $   dd t |D }| | t|S )z#Include files that match 'pattern'.c                 S      g | ]
}t j|s|qS r7   r!   r"   isdir.0r   r7   r7   r8   
<listcomp>  s    z$FileList.include.<locals>.<listcomp>r   extendboolr?   r   r   r7   r7   r8   r     s   
zFileList.includec                 C   s   t |}| |jS )z#Exclude files that match 'pattern'.)r9   r   matchr?   r   r   r7   r7   r8   r     s   zFileList.excludec                 C   s8   t j|d|}dd t|ddD }| | t|S )zN
        Include all files anywhere in 'dir/' that match the pattern.
        r   c                 S   r   r7   r   r   r7   r7   r8   r     s    

z.FileList.recursive_include.<locals>.<listcomp>T)	recursive)r!   r"   rs   r   r   r   )r?   r   r   full_patternr   r7   r7   r8   r     s   
zFileList.recursive_includec                 C   s    t tj|d|}| |jS )zM
        Exclude any file anywhere in 'dir/' that match the pattern.
        r   r9   r!   r"   rs   r   r   )r?   r   r   r   r7   r7   r8   r     s   zFileList.recursive_excludec                 C   r   )zInclude all files from 'dir/'.c                 S   s"   g | ]}t j|D ]}|q
qS r7   )rl   r   findall)r   	match_diritemr7   r7   r8   r     s    
z"FileList.graft.<locals>.<listcomp>r   )r?   r   r   r7   r7   r8   r     s
   
zFileList.graftc                 C   s   t tj|d}| |jS )zFilter out files from 'dir/'.r   r   )r?   r   r   r7   r7   r8   r     s   zFileList.prunec                    sJ   | j du r	|   ttjd|  fdd| j D }| | t|S )z
        Include all files anywhere in the current directory that match the
        pattern. This is very inefficient on large file trees.
        Nr   c                    s   g | ]	}  |r|qS r7   r   r   r   r7   r8   r     s    z+FileList.global_include.<locals>.<listcomp>)allfilesr   r9   r!   r"   rs   r   r   r   r7   r   r8   r     s   

zFileList.global_includec                 C   s   t tjd|}| |jS )zD
        Exclude all files anywhere that match the pattern.
        r   r   r   r7   r7   r8   r     s   zFileList.global_excludec                 C   s<   | dr|d d }t|}| |r| j| d S d S )Nr   )rE   r   
_safe_pathr   append)r?   r   r"   r7   r7   r8   r     s   

zFileList.appendc                 C   s   | j t| j| d S r;   )r   r   filterr   )r?   pathsr7   r7   r8   r     s   zFileList.extendc                 C   s   t t| j| j| _dS )z
        Replace self.files with only safe paths

        Because some owners of FileList manipulate the underlying
        ``files`` attribute directly, this method must be called to
        repair those paths.
        N)rj   r   r   r   r>   r7   r7   r8   _repair  s   zFileList._repairc              	   C   s   d}t |}|d u rtd|  dS t |d}|d u r't||d dS ztj|s4tj|r7W dS W d S  tyL   t||t	
  Y d S w )Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFr   T)unicode_utilsfilesys_decoder   r   
try_encoder!   r"   r   UnicodeEncodeErrorsysgetfilesystemencoding)r?   r"   enc_warnu_path	utf8_pathr7   r7   r8   r     s    
zFileList._safe_pathN)rM   rN   rO   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r7   r7   r7   r8   r   E  s    M


r   c                   @   sl   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	e
dd Zdd Zdd Zdd Zdd ZdS )r   zMANIFEST.inc                 C   s   d| _ d| _d| _d| _d S )Nr   )use_defaultsr   manifest_onlyforce_manifestr>   r7   r7   r8   r\     s   
z!manifest_maker.initialize_optionsc                 C   r]   r;   r7   r>   r7   r7   r8   r     s   zmanifest_maker.finalize_optionsc                 C   sl   t  | _tj| js|   |   tj| jr| 	  | 
  |   | j  | j  |   d S r;   )r   r   r!   r"   r   r   write_manifestadd_defaultstemplateread_templateadd_license_filesprune_file_listsortremove_duplicatesr>   r7   r7   r8   r     s   

zmanifest_maker.runc                 C   s   t |}|tjdS )N/)r   r   replacer!   r#   )r?   r"   r7   r7   r8   _manifest_normalize&  s   
z"manifest_maker._manifest_normalizec                    sB    j    fdd j jD }d j } t j|f| dS )zo
        Write the file list in 'self.filelist' to the manifest file
        named by 'self.manifest'.
        c                    s   g | ]}  |qS r7   )r   r   r>   r7   r8   r   2  s    z1manifest_maker.write_manifest.<locals>.<listcomp>zwriting manifest file '%s'N)r   r   r   r   executer   )r?   r   msgr7   r>   r8   r   *  s   

zmanifest_maker.write_manifestc                 C   s   |  |st| | d S d S r;   )_should_suppress_warningr   r   )r?   r   r7   r7   r8   r   6  s   
zmanifest_maker.warnc                 C   s   t d| S )z;
        suppress missing-file warnings from sdist
        zstandard file .*not found)r$   r   )r   r7   r7   r8   r  :  s   z'manifest_maker._should_suppress_warningc                 C   s   t |  | j| j | j| j tt }|r!| j| nt	j
| jr,|   t	j
dr8| jd | d}| j|j d S )Nzsetup.pyrQ   )r   r   r   r   r   r   rj   r   r   r!   r"   r   read_manifestget_finalized_commandr   rQ   )r?   rcfilesei_cmdr7   r7   r8   r   A  s   


zmanifest_maker.add_defaultsc                 C   s4   | j jjpg }|D ]}td| q	| j| d S )Nzadding license file '%s')r<   ru   license_filesr   r   r   r   )r?   r  lfr7   r7   r8   r   S  s
   z manifest_maker.add_license_filesc                 C   sZ   |  d}| j }| j|j | j| ttj	}| jj
d| d | dd d S )Nbuildz(^|z)(RCS|CVS|\.svn)r   )is_regex)r  r<   get_fullnamer   r   
build_baser$   r%   r!   r#   exclude_pattern)r?   r  base_dirr#   r7   r7   r8   r   Z  s   


zmanifest_maker.prune_file_listc                 C   s&   t |dr	| S tdt | S )a0  
        The parent class implementation of this method
        (``sdist``) will try to include data files, which
        might cause recursion problems when
        ``include_package_data=True``.

        Therefore, avoid triggering any attempt of
        analyzing/building the manifest again.
        get_data_files_without_manifestzCustom 'build_py' does not implement 'get_data_files_without_manifest'.
Please extend command classes from setuptools instead of distutils.)hasattrr  warningsr   r   get_data_files)r?   build_pyr7   r7   r8   _safe_data_filesc  s   

zmanifest_maker._safe_data_filesN)rM   rN   rO   r   r\   r   r   r   r   r   staticmethodr  r   r   r   r  r7   r7   r7   r8   r     s    
	r   c                 C   sN   d |}|d}t| d}|| W d   dS 1 s w   Y  dS )z{Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    
r   r   N)rs   r   r   r   )rd   contentsr   r7   r7   r8   r   y  s
   

"r   c              	   C   s   t d| | jsE| jj}| j|j|_}| j|j|_}z|	| j
 W |||_|_n|||_|_w t| jdd }t| j
| d S d S )Nz
writing %szip_safe)r   r   r   r<   ru   rZ   rG   rY   r@   write_pkg_inforQ   getattrr
   write_safety_flag)cmdbasenamerd   ru   oldveroldnamesafer7   r7   r8   r    s    r  c                 C   s   t j|rtd d S d S )NzsWARNING: 'depends.txt' is not used by setuptools 0.6!
Use the install_requires/extras_require setup() args instead.)r!   r"   r   r   r   r  r  rd   r7   r7   r8   warn_depends_obsolete  s
   r!  c                 C   s0   t |pd}dd }t|t|}| | d S )Nr7   c                 S   s   | d S )Nr  r7   )r   r7   r7   r8   	append_cr  s   z&_write_requirements.<locals>.append_cr)r   mapsorted
writelines)streamreqslinesr"  r7   r7   r8   _write_requirements  s   r)  c                 C   sn   | j }t }t||j |jpi }t|D ]}|djdi t	  t|||  q| 
d||  d S )Nz
[{extra}]
requirementsr7   )r<   ioStringIOr)  install_requiresextras_requirer$  r   r   varsr   getvalue)r  r  rd   distr   r.  extrar7   r7   r8   write_requirements  s   
r3  c                 C   s,   t  }t|| jj | d||  d S )Nzsetup-requirements)r+  r,  r)  r<   setup_requiresr   r0  )r  r  rd   r   r7   r7   r8   write_setup_requirements  s   r5  c                 C   s:   t dd | j D }| d|dt|d  d S )Nc                 S   s   g | ]
}| d dd qS ).r   r   )r    )r   kr7   r7   r8   r     s    z(write_toplevel_names.<locals>.<listcomp>ztop-level namesr  )rc   fromkeysr<   iter_distribution_namesr   rs   r$  )r  r  rd   pkgsr7   r7   r8   write_toplevel_names  s    r;  c                 C   s   t | ||d d S )NT)	write_argr   r7   r7   r8   overwrite_arg  s   r=  Fc                 C   sH   t j|d }t| j|d }|d urd|d }| |||| d S )Nr   r  )r!   r"   splitextr  r<   rs   r   )r  r  rd   r   argnamer`   r7   r7   r8   r<    s
   r<  c                 C   s   | j j}t|ts|d u r|}n6|d urFg }t| D ]$\}}t|ts7t||}dtt	t|
 }|d||f  qd|}| d||d d S )Nr  z	[%s]
%s

r   zentry pointsT)r<   entry_pointsrh   strr$  itemsr   parse_grouprs   r#  valuesr   r   )r  r  rd   r   r   sectionr  r7   r7   r8   write_entries  s   

rF  c                  C   s   t dt tjdr?td&} | D ]}t	d|}|r.t
|d  W  d   S qW d   dS 1 s:w   Y  dS )zd
    Get a -r### off of PKG-INFO Version in case this is an sdist of
    a subversion revision.
    z$get_pkg_info_revision is deprecated.zPKG-INFOzVersion:.*-r(\d+)\s*$r   Nr   )r  r   EggInfoDeprecationWarningr!   r"   r   r+  r   r$   r   intgroup)r   r   r   r7   r7   r8   get_pkg_info_revision  s    
rJ  c                   @   s   e Zd ZdZdS )rG  z?Deprecated behavior warning for EggInfo, bypassing suppression.N)rM   rN   rO   __doc__r7   r7   r7   r8   rG    s    rG  r   );rK  distutils.filelistr   	_FileListdistutils.errorsr   distutils.utilr   rl   r   r   r!   r$   r   r+  r  rJ   ra   
setuptoolsr   setuptools.command.sdistr   r   setuptools.command.setoptr	   setuptools.commandr
   pkg_resourcesr   r   r   r   r   r   r   r   setuptools.unicode_utilsr   setuptools.globr   setuptools.externr   r   r9   r:   rQ   r   r   r  r!  r)  r3  r5  r;  r=  r<  rF  rJ  rG  r7   r7   r7   r8   <module>   sX    (S 1 Il	

