Your IP : 18.116.28.79


Current Path : /lib64/python3.8/distutils/command/__pycache__/
Upload File :
Current File : //lib64/python3.8/distutils/command/__pycache__/sdist.cpython-38.opt-2.pyc

U

e5d=J�@s�ddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	l
mZdd
lmZddlmZddlmZmZd
d�ZGdd�de�ZdS)�N)�glob)�warn)�Command)�dir_util)�	file_util)�archive_util)�TextFile)�FileList)�log)�convert_path)�DistutilsTemplateError�DistutilsOptionErrorcCs`ddlm}ddlm}g}|��D] }|�d|d||df�q$|��||��d�dS)Nr)�FancyGetopt)�ARCHIVE_FORMATS�formats=�z.List of available source distribution formats:)Zdistutils.fancy_getoptrZdistutils.archive_utilr�keys�append�sortZ
print_help)rr�formats�format�r�//usr/lib64/python3.8/distutils/command/sdist.py�show_formatss
��rc@s"eZdZdZdd�Zdddddd	d
ddd
ddddgZddddddgZdddefgZddd�Z	defgZ
dZdd�Zd d!�Z
d"d#�Zd$d%�Zd&d'�Zd(d)�Zed*d+��Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Zd@dA�ZdBdC�ZdDdE�Z dFdG�Z!dHdI�Z"dS)J�sdistz6create a source distribution (tarball, zip file, etc.)cCs|jS�N)�metadata_check��selfrrr�checking_metadata(szsdist.checking_metadata)z	template=�tz5name of manifest template file [default: MANIFEST.in])z	manifest=�mz)name of manifest file [default: MANIFEST])�use-defaultsNzRinclude the default file set in the manifest [default; disable with --no-defaults])�no-defaultsNz"don't include the default file set)�pruneNz�specifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune])�no-pruneNz$don't automatically exclude anything)�
manifest-only�ozEjust regenerate the manifest and then stop (implies --force-manifest))�force-manifest�fzkforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.)rNz6formats for source distribution (comma-separated list))�	keep-temp�kz@keep the distribution tree around after creating archive file(s))z	dist-dir=�dzFdirectory to put the source distribution archive(s) in [default: dist])�metadata-checkNz[Ensure that all required elements of meta-data are supplied. Warn if any missing. [default])zowner=�uz@Owner name used when creating a tar file [default: current user])zgroup=�gzAGroup name used when creating a tar file [default: current group]r"r$r&r(r*r-zhelp-formatsNz#list available distribution formats)r#r%�check)ZREADMEz
README.txtz
README.rstcCsTd|_d|_d|_d|_d|_d|_dg|_d|_d|_d|_	d|_
d|_d|_dS)N�rZgztar)
�template�manifest�use_defaultsr$�
manifest_onlyZforce_manifestr�	keep_temp�dist_dir�
archive_filesr�owner�grouprrrr�initialize_optionseszsdist.initialize_optionscCsZ|jdkrd|_|jdkr d|_|�d�t�|j�}|rFtd|��|jdkrVd|_dS)NZMANIFESTzMANIFEST.inrzunknown archive format '%s'Zdist)r3r2Zensure_string_listrZcheck_archive_formatsrr
r7)rZ
bad_formatrrr�finalize_options|s


�
zsdist.finalize_optionscCs>t�|_|��D]}|�|�q|��|jr2dS|��dSr)r	�filelistZget_sub_commandsZrun_command�
get_file_listr5�make_distribution)rZcmd_namerrr�run�sz	sdist.runcCs*tdt�|j�d�}|��|��dS)Nzadistutils.command.sdist.check_metadata is deprecated,               use the check command insteadr0)r�PendingDeprecationWarning�distributionZget_command_objZensure_finalizedr@)rr0rrr�check_metadata�s�zsdist.check_metadatacCs�tj�|j�}|s:|��r:|��|j��|j��dS|sN|�	d|j�|j�
�|jrf|��|rr|�
�|jr�|��|j��|j��|��dS)Nz?manifest template '%s' does not exist (using default file list))�os�path�isfiler2�_manifest_is_not_generated�
read_manifestr=rZremove_duplicatesr�findallr4�add_defaults�
read_templater$�prune_file_list�write_manifest)rZtemplate_existsrrrr>�s(

�


zsdist.get_file_listcCs<|��|��|��|��|��|��|��dSr)�_add_defaults_standards�_add_defaults_optional�_add_defaults_python�_add_defaults_data_files�_add_defaults_ext�_add_defaults_c_libs�_add_defaults_scriptsrrrrrJ�szsdist.add_defaultscCs:tj�|�sdStj�|�}tj�|�\}}|t�|�kS)NF)rDrE�exists�abspath�split�listdir)�fspathrVZ	directory�filenamerrr�_cs_path_exists�s

zsdist._cs_path_existscCs�|j|jjg}|D]~}t|t�rj|}d}|D]"}|�|�r,d}|j�|�qPq,|s�|�dd�	|��q|�|�r�|j�|�q|�d|�qdS)NFTz,standard file not found: should have one of z, zstandard file '%s' not found)
�READMESrBZscript_name�
isinstance�tupler[r=rr�join)rZ	standards�fnZaltsZgot_itrrrrN�s"

�
zsdist._add_defaults_standardscCs4ddg}|D]"}ttjjt|��}|j�|�qdS)Nz
test/test*.pyz	setup.cfg)�filterrDrErFrr=�extend)rZoptional�pattern�filesrrrrOszsdist._add_defaults_optionalcCs\|�d�}|j��r$|j�|���|jD],\}}}}|D]}|j�tj	�
||��q:q*dS)N�build_py)�get_finalized_commandrBZhas_pure_modulesr=rb�get_source_files�
data_filesrrDrEr_)rreZpkgZsrc_dirZ	build_dir�	filenamesrZrrrrPs

zsdist._add_defaults_pythoncCsz|j��rv|jjD]b}t|t�rBt|�}tj�|�rt|j	�
|�q|\}}|D]$}t|�}tj�|�rN|j	�
|�qNqdSr)rBZhas_data_filesrhr]�strrrDrErFr=r)r�item�dirnamerir)rrrrQ$s

zsdist._add_defaults_data_filescCs(|j��r$|�d�}|j�|���dS)N�	build_ext)rBZhas_ext_modulesrfr=rbrg)rrmrrrrR5s

zsdist._add_defaults_extcCs(|j��r$|�d�}|j�|���dS)N�
build_clib)rBZhas_c_librariesrfr=rbrg)rrnrrrrS:s

zsdist._add_defaults_c_libscCs(|j��r$|�d�}|j�|���dS)N�
build_scripts)rBZhas_scriptsrfr=rbrg)rrorrrrT?s

zsdist._add_defaults_scriptsc
Cs�t�d|j�t|jddddddd�}zh|��}|dkr:q�z|j�|�Wq(tt	fk
r�}z|�
d|j|j|f�W5d}~XYq(Xq(W5|��XdS)Nzreading manifest template '%s'r1)Zstrip_commentsZskip_blanksZ
join_linesZ	lstrip_wsZ	rstrip_wsZ
collapse_joinz%s, line %d: %s)
r
�infor2r�close�readliner=Zprocess_template_liner�
ValueErrorrrZZcurrent_line)rr2�line�msgrrrrKDs&
�
� zsdist.read_templatecCs�|�d�}|j��}|jjd|jd�|jjd|d�tjdkrFd}nd}dddd	d
ddg}d
|d�|�|f}|jj|dd�dS)N�build)�prefixZwin32z/|\\�/ZRCSZCVSz\.svnz\.hgz\.gitz\.bzrZ_darcsz(^|%s)(%s)(%s).*�|r1)Zis_regex)	rfrB�get_fullnamer=Zexclude_patternZ
build_base�sys�platformr_)rrv�base_dirZsepsZvcs_dirsZvcs_ptrnrrrrLas


�zsdist.prune_file_listcCsX|��rt�d|j�dS|jjdd�}|�dd�|�tj	|j|fd|j�dS)Nz5not writing to manually maintained manifest file '%s'rz*# file GENERATED by distutils, do NOT editzwriting manifest file '%s')
rGr
rpr3r=rd�insertZexecuterZ
write_file)rZcontentrrrrMys��zsdist.write_manifestcCs<tj�|j�sdSt|j�}z|��}W5|��X|dkS)NFz+# file GENERATED by distutils, do NOT edit
)rDrErFr3�openrqrr)r�fpZ
first_linerrrrG�s

z sdist._manifest_is_not_generatedc	CsVt�d|j�t|j��4}|D](}|��}|�d�s|s:q|j�|�qW5QRXdS)Nzreading manifest file '%s'�#)r
rpr3r�strip�
startswithr=r)rr3rtrrrrH�szsdist.read_manifestcCs�|�|�tj|||jd�ttd�r4d}d|}nd}d|}|sPt�d�n
t�|�|D]<}tj	�
|�s|t�d|�q^tj	�||�}|j|||d�q^|j
j�|�dS)	N��dry_run�linkZhardzmaking hard links in %s...zcopying files to %s...z)no files to distribute -- empty manifest?z#'%s' not a regular file -- skipping)r�)ZmkpathrZcreate_treer��hasattrrDr
rrprErFr_Z	copy_filerBZmetadataZwrite_pkg_info)rr}rdr�ru�file�destrrr�make_release_tree�s 
	


zsdist.make_release_treecCs�|j��}tj�|j|�}|�||jj�g}d|j	krT|j	�
|j	�|j	�d���|j	D]:}|j
||||j|jd�}|�
|�|jj�
dd|f�qZ||_|js�tj||jd�dS)NZtar)r}r9r:r�r�)rBrzrDrEr_r7r�r=rdrr�pop�indexZmake_archiver9r:Z
dist_filesr8r6rZremove_treer�)rr}Z	base_namer8Zfmtr�rrrr?�s 




�
zsdist.make_distributioncCs|jSr)r8rrrr�get_archive_files�szsdist.get_archive_files)#�__name__�
__module__�__qualname__ZdescriptionrZuser_optionsZboolean_optionsrZhelp_optionsZnegative_optZsub_commandsr\r;r<r@rCr>rJ�staticmethodr[rNrOrPrQrRrSrTrKrLrMrGrHr�r?r�rrrrr$sp�'����
(
*r)rDr{r�warningsrZdistutils.corerZ	distutilsrrrZdistutils.text_filerZdistutils.filelistr	r
Zdistutils.utilrZdistutils.errorsrr
rrrrrr�<module>s

?>