Your IP : 18.191.26.149


Current Path : /opt/alt/python35/lib64/python3.5/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/command/__pycache__/sdist.cpython-35.opt-2.pyc



���]-G�@s�ddlZddlZddlZddlTddlmZddlmZddlmZddl	m
Z
mZmZm
Z
ddlmZddlTddlmZdd	l	mZdd
lmZdd�ZGd
d�de�ZdS)�N)�*)�glob)�warn)�Command)�dir_util�dep_util�	file_util�archive_util)�TextFile)�FileList)�log)�convert_pathcCs�ddlm}ddlm}g}x6|j�D](}|jd|d||df�q3W|j�||�jd�dS)Nr)�FancyGetopt)�ARCHIVE_FORMATSzformats=�z.List of available source distribution formats:)Zdistutils.fancy_getoptrZdistutils.archive_utilr�keys�append�sort�
print_help)rr�formats�format�r�*/opt/alt/python35/lib64/python3.5/sdist.py�show_formatss
rc@sgeZdZdZdd�ZdMdNdOdPdQdRdSdTdUddddfdVdWdXdYgZd
ddddd"gZd*dd+efgZd
d
ddiZ	d,d-d.d/iZ
d0efgZd1d2�Zd3d4�Z
d5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Zd?d@�ZdAdB�ZdCdD�ZdEdF�ZdGdH�ZdIdJ�ZdKdL�ZdS)Z�sdistz6create a source distribution (tarball, zip file, etc.)cCs|jS)N)�metadata_check)�selfrrr�checking_metadata&szsdist.checking_metadata�	template=�t�5name of manifest template file [default: MANIFEST.in]�	manifest=�m�)name of manifest file [default: MANIFEST]�use-defaultsN�Rinclude the default file set in the manifest [default; disable with --no-defaults]�no-defaults�"don't include the default file set�prune��specifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune]�no-prune�$don't automatically exclude anything�
manifest-only�o�Ejust regenerate the manifest and then stop (implies --force-manifest)�force-manifest�f�kforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.�formats=�6formats for source distribution (comma-separated list)z	keep-temp�kz1keep the distribution tree around after creating zarchive file(s)�	dist-dir=�d�Fdirectory to put the source distribution archive(s) in [default: dist]�metadata-check�[Ensure that all required elements of meta-data are supplied. Warn if any missing. [default]�owner=�u�@Owner name used when creating a tar file [default: current user]�group=�g�AGroup name used when creating a tar file [default: current group]zhelp-formatsz#list available distribution formats�posix�gztar�nt�zip�checkcCsyd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_dS)N�r)
�template�manifest�use_defaultsr(�
manifest_onlyZforce_manifestr�	keep_temp�dist_dir�
archive_filesr�owner�group)rrrr�initialize_optionsds												zsdist.initialize_optionscCs�|jdkrd|_|jdkr0d|_|jd�|jdkr�y|jtjg|_Wn%tk
r�tdtj��YnXt	j
|j�}|r�td|��|jdkr�d|_dS)NZMANIFESTzMANIFEST.inrz<don't know how to create source distributions on platform %szunknown archive format '%s'Zdist)
rGrFZensure_string_listr�default_format�os�name�KeyErrorZDistutilsPlatformErrorr	Zcheck_archive_formatsZDistutilsOptionErrorrK)rZ
bad_formatrrr�finalize_options{s$		


zsdist.finalize_optionscCsUt�|_x!|j�D]}|j|�qW|j�|jrGdS|j�dS)N)r�filelistZget_sub_commandsZrun_command�
get_file_listrI�make_distribution)rZcmd_namerrr�run�s
	z	sdist.runcCs7tdt�|jjd�}|j�|j�dS)Nzadistutils.command.sdist.check_metadata is deprecated,               use the check command insteadrD)r�PendingDeprecationWarning�distributionZget_command_objZensure_finalizedrX)rrDrrr�check_metadata�s


zsdist.check_metadatacCs�tjj|j�}|rP|j�rP|j�|jj�|jj�dS|sn|j	dd|j�|jj
�|jr�|j�|r�|j
�|jr�|j�|jj�|jj�|j�dS)Nz&manifest template '%s' does not exist z(using default file list))rQ�path�isfilerF�_manifest_is_not_generated�
read_manifestrUrZremove_duplicatesr�findallrH�add_defaults�
read_templater(�prune_file_list�write_manifest)rZtemplate_existsrrrrV�s(


	
	

	


zsdist.get_file_listcCs�d|jjg}x�|D]�}t|t�r�|}d}x7|D]/}tjj|�rAd}|jj|�PqAW|s�|j	ddj
|��qtjj|�r�|jj|�q|j	d|�qWdd	g}x9|D]1}ttjjt
|��}|jj|�q�W|jd
�}|jj�rM|jj|j��xM|jD]B\}	}
}}x-|D]%}
|jjtjj
|
|
��qpWqWW|jj�rNx�|jjD]�}t|t�r�t|�}tjj|�rJ|jj|�q�|\}}x<|D]4}t|�}tjj|�r|jj|�qWq�W|jj�r�|jd�}|jj|j��|jj�r�|jd�}|jj|j��|jj�r�|jd
�}|jj|j��dS)N�README�
README.txtFTz,standard file not found: should have one of z, zstandard file '%s' not foundz
test/test*.pyz	setup.cfg�build_py�	build_ext�
build_clib�
build_scripts)rerf)rZZscript_name�
isinstance�tuplerQr\�existsrUrr�join�filterr]r�extend�get_finalized_commandZhas_pure_modulesZget_source_filesZ
data_filesZhas_data_files�strr
Zhas_ext_modulesZhas_c_librariesZhas_scripts)rZ	standards�fnZaltsZgot_itZoptional�pattern�filesrgZpkgZsrc_dirZ	build_dir�	filenames�filename�item�dirnamer0rhrirjrrrra�s\

	

'
zsdist.add_defaultscCs�tjd|j�t|jdddddddddddd�}z�x|j�}|dkrePy|jj|�WqLttfk
r�}z%|j	d	|j
|j|f�WYdd}~XqLXqLWWd|j�XdS)
Nzreading manifest template '%s'Zstrip_commentsrEZskip_blanksZ
join_linesZ	lstrip_wsZ	rstrip_wsZ
collapse_joinz%s, line %d: %s)
r�inforFr
�readlinerUZprocess_template_lineZDistutilsTemplateError�
ValueErrorrrwZcurrent_line�close)rrF�line�msgrrrrb(s 	&zsdist.read_templatecCs�|jd�}|jj�}|jjdd|j�|jjdd|�tjdkred}nd}dddd	d
ddg}d
|dj|�|f}|jj|dd�dS)N�build�prefix�win32z/|\\�/ZRCSZCVSz\.svnz\.hgz\.gitz\.bzrZ_darcsz(^|%s)(%s)(%s).*�|Zis_regexrE)	rqrZ�get_fullnamerUZexclude_patternZ
build_base�sys�platformrn)rr��base_dir�sepsZvcs_dirsZvcs_ptrnrrrrcEs		zsdist.prune_file_listcCst|j�r$tjd|j�dS|jjdd�}|jdd�|jtj	|j|fd|j�dS)Nz5not writing to manually maintained manifest file '%s'rz*# file GENERATED by distutils, do NOT editzwriting manifest file '%s')
r^rrzrGrUru�insertZexecuterZ
write_file)rZcontentrrrrd]s	zsdist.write_manifestc
CsPtjj|j�sdSt|j�}z|j�}Wd|j�X|dkS)NFz+# file GENERATED by distutils, do NOT edit
)rQr\r]rG�openr{r})r�fpZ
first_linerrrr^lsz sdist._manifest_is_not_generatedcCsvtjd|j�t|j�}xC|D];}|j�}|jd�s)|rTq)|jj|�q)W|j�dS)Nzreading manifest file '%s'�#)	rrzrGr��strip�
startswithrUrr})rrGr~rrrr_xs
zsdist.read_manifestcCs�|j|�tj||d|j�ttd�rHd}d|}nd}d|}|sntjd�n
tj|�x_|D]W}tj	j
|�s�tjd|�q�tj	j||�}|j||d|�q�W|j
jj|�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)ZmkpathrZcreate_treer��hasattrrQrrrzr\r]rnZ	copy_filerZZmetadataZwrite_pkg_info)rr�rur�r�file�destrrr�make_release_tree�s 
	



zsdist.make_release_treec
Cs
|jj�}tjj|j|�}|j||jj�g}d|j	krz|j	j
|j	j|j	jd���xd|j	D]Y}|j
||d|d|jd|j�}|j
|�|jjj
dd|f�q�W||_|js	tj|d|j�dS)N�tarr�rMrNr�r�)rZr�rQr\rnrKr�rUrurr�pop�index�make_archiverMrNZ
dist_filesrLrJrZremove_treer�)rr��	base_namerL�fmtr�rrrrW�s
(
 		zsdist.make_distributioncCs|jS)N)rL)rrrr�get_archive_files�szsdist.get_archive_files)rrr )r!r"r#)r$Nr%)r&Nr')r(Nr))r*Nr+)r,r-r.)r/r0r1)r2Nr3)r5r6r7)r8Nr9)r:r;r<)r=r>r?)�__name__�
__module__�__qualname__�descriptionrZuser_optionsZboolean_optionsrZhelp_optionsZnegative_optrPZsub_commandsrOrTrXr[rVrarbrcrdr^r_r�rWr�rrrrr"sn	(P*r)rQ�stringr��typesr�warningsrZdistutils.corerZ	distutilsrrrr	Zdistutils.text_filer
Zdistutils.errorsZdistutils.filelistrrZdistutils.utilr
rrrrrr�<module>s
"


?>