ok

Mini Shell

Direktori : /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.pyc



M�Ma-G�@s�dZddlZddlZddlZddlTddlmZddlmZddlm	Z	ddl
mZmZm
Z
mZddlmZddlTdd	lmZdd
l
mZddlmZdd
�ZGdd�de	�ZdS)zadistutils.command.sdist

Implements the Distutils 'sdist' command (create a source distribution).�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)zoPrint all possible values for the 'formats' option (used by
    the "--help-formats" command-line option).
    r)�FancyGetopt)�ARCHIVE_FORMATSzformats=N�z.List of available source distribution formats:)Zdistutils.fancy_getoptrZdistutils.archive_utilr�keys�append�sortZ
print_help)rr�formats�format�r�</opt/alt/python35/lib64/python3.5/distutils/command/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)zYCallable used for the check sub-command.

        Placed here so user_options can view it)�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�posixZgztar�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)
rErDZensure_string_listr�default_format�os�name�KeyErrorZDistutilsPlatformErrorr	Zcheck_archive_formatsZDistutilsOptionErrorrI)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_listrG�make_distribution)rZcmd_namerrr�run�s
	z	sdist.runcCs7tdt�|jjd�}|j�|j�dS)zDeprecated API.zadistutils.command.sdist.check_metadata is deprecated,               use the check command insteadrBN)r�PendingDeprecationWarning�distributionZget_command_objZensure_finalizedrV)rrBrrr�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)aCFigure out the list of files to include in the source
        distribution, and put it in 'self.filelist'.  This might involve
        reading the manifest template (and writing the manifest), or just
        reading the manifest, or just using the default file set -- it all
        depends on the user's options.
        Nz&manifest template '%s' does not exist z(using default file list))rO�path�isfilerD�_manifest_is_not_generated�
read_manifestrSrZremove_duplicatesr�findallrF�add_defaults�
read_templater'�prune_file_list�write_manifest)rZtemplate_existsrrrrT�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)a9Add all the default files to self.filelist:
          - README or README.txt
          - setup.py
          - test/test*.py
          - all pure Python modules mentioned in setup script
          - all files pointed by package_data (build_py)
          - all files defined in data_files.
          - all files defined as scripts.
          - all C sources listed as part of extensions or C libraries
            in the setup script (doesn't catch C headers!)
        Warns if (README or README.txt) or setup.py are missing; everything
        else is optional.
        �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_scriptsN)rcrd)rXZscript_name�
isinstance�tuplerOrZ�existsrSrr�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�filesreZpkgZsrc_dirZ	build_dir�	filenames�filename�item�dirnamer/rfrgrhrrrr_�s\

	

'
zsdist.add_defaultscCs�tjd|j�t|jdddddddddddd�}z�x|j�}|d	krePy|jj|�WqLttfk
r�}z%|j	d
|j
|j|f�WYd	d	}~XqLXqLWWd	|j�Xd	S)z�Read and parse manifest template file named by self.template.

        (usually "MANIFEST.in") The parsing and processing is done by
        'self.filelist', which updates itself accordingly.
        zreading manifest template '%s'Zstrip_commentsrCZskip_blanksZ
join_linesZ	lstrip_wsZ	rstrip_wsZ
collapse_joinNz%s, line %d: %s)
r�inforDr
�readlinerSZprocess_template_lineZDistutilsTemplateError�
ValueErrorrruZcurrent_line�close)rrD�line�msgrrrr`(s 	&zsdist.read_templatecCs�|jd�}|jj�}|jjdd|j�|jjdd|�tjdkred}nd}ddd	d
ddd
g}d|dj|�|f}|jj|dd�dS)avPrune off branches that might slip into the file list as created
        by 'read_template()', but really don't belong there:
          * the build tree (typically "build")
          * the release tree itself (only an issue if we ran "sdist"
            previously with --keep-temp, or it aborted)
          * any RCS, CVS, .svn, .hg, .git, .bzr, _darcs directories
        �buildN�prefix�win32z/|\\�/ZRCSZCVSz\.svnz\.hgz\.gitz\.bzrZ_darcsz(^|%s)(%s)(%s).*�|Zis_regexrC)	rorX�get_fullnamerSZexclude_patternZ
build_base�sys�platformrl)rr~�base_dirZsepsZvcs_dirsZvcs_ptrnrrrraEs		zsdist.prune_file_listcCst|j�r$tjd|j�dS|jjdd�}|jdd�|jtj	|j|fd|j�dS)z�Write the file list in 'self.filelist' (presumably as filled in
        by 'add_defaults()' and 'read_template()') to the manifest file
        named by 'self.manifest'.
        z5not writing to manually maintained manifest file '%s'Nrz*# file GENERATED by distutils, do NOT editzwriting manifest file '%s')
r\rrxrErSrs�insertZexecuterZ
write_file)rZcontentrrrrb]s	zsdist.write_manifestc
CsPtjj|j�sdSt|j�}z|j�}Wd|j�X|dkS)NFz+# file GENERATED by distutils, do NOT edit
)rOrZr[rE�openryr{)r�fpZ
first_linerrrr\lsz sdist._manifest_is_not_generatedcCsvtjd|j�t|j�}xC|D];}|j�}|jd�s)|rTq)|jj|�q)W|j�dS)z�Read the manifest file (named by 'self.manifest') and use it to
        fill in 'self.filelist', the list of files to include in the source
        distribution.
        zreading manifest file '%s'�#N)	rrxrEr��strip�
startswithrSrr{)rrEr|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)	a�Create the directory tree that will become the source
        distribution archive.  All directories implied by the filenames in
        'files' are created under 'base_dir', and then we hard link or copy
        (if hard linking is unavailable) those files into place.
        Essentially, this duplicates the developer's source tree, but in a
        directory named after the distribution, containing only the files
        to be distributed.
        �dry_run�linkZhardzmaking hard links in %s...Nzcopying files to %s...z)no files to distribute -- empty manifest?z#'%s' not a regular file -- skipping)ZmkpathrZcreate_treer��hasattrrOrrrxrZr[rlZ	copy_filerXZmetadataZwrite_pkg_info)rr�rsr�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)	a�Create the source distribution(s).  First, we create the release
        tree with 'make_release_tree()'; then, we create all required
        archive files (according to 'self.formats') from the release tree.
        Finally, we clean up by blowing away the release tree (unless
        'self.keep_temp' is true).  The list of archive files created is
        stored so it can be retrieved later by 'get_archive_files()'.
        Ztarr�rKrLr�r�N)rXr�rOrZrlrIr�rSrsrr�pop�indexZmake_archiverKrLZ
dist_filesrJrHrZremove_treer�)rr�Z	base_namerJZfmtr�rrrrU�s
(
 		zsdist.make_distributioncCs|jS)zzReturn the list of archive files created when the command
        was run, or None if the command hasn't run yet.
        )rJ)rrrr�get_archive_files�szsdist.get_archive_files)rrr)r r!r")r#Nr$)r%Nr&)r'Nr()r)Nr*)r+r,r-)r.r/r0)r1Nr2)r4r5r6)r7Nr8)r9r:r;)r<r=r>)�__name__�
__module__�__qualname__ZdescriptionrZuser_optionsZboolean_optionsrZhelp_optionsZnegative_optrNZsub_commandsrMrRrVrYrTr_r`rarbr\r]r�rUr�rrrrr"sn	(P*r)�__doc__rO�stringr��typesr�warningsrZdistutils.corerZ	distutilsrrrr	Zdistutils.text_filer
Zdistutils.errorsZdistutils.filelistrrZdistutils.utilr
rrrrrr�<module>s
"


Zerion Mini Shell 1.0