Edit File: sdist.cpython-36.pyc
3 � \�E������������������@���s����d�Z�ddlZddlZddlT�ddlmZ�ddlmZ�ddlmZ�ddl m Z mZmZm Z �ddlmZ�ddlT�dd lmZ�dd l mZ�ddlmZ�dd ��ZG�dd��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_pathc��������������C���sd���ddl�m}��ddlm}�g�}x,|j��D�] }|jd|�d||�d�f��q&W�|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_getoptr���Zdistutils.archive_utilr����keys�append�sortZ print_help)r���r����formats�format��r����//usr/lib64/python3.6/distutils/command/sdist.py�show_formats���s����r���c���������������@���s����e�Zd�ZdZdd��ZdJdKdLdMdNdOdPdQdRdTdUdVdWdXgZd ddddd"gZd*dd+efgZd dd,�Z d-efgZ d.d/��Zd0d1��Zd2d3��Z d4d5��Zd6d7��Zd8d9��Zd:d;��Zd<d=��Zd>d?��Zd@dA��ZdBdC��ZdDdE��ZdFdG��ZdHdI��ZdS�)Y�sdistz6create a source distribution (tarball, zip file, etc.)c�������������C���s���|�j�S�)zYCallable used for the check sub-command. Placed here so user_options can view it)�metadata_check)�selfr���r���r����checking_metadata%���s����zsdist.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)� 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]zhelp-formatsz#list available distribution formats)zno-defaultszno-prune�checkc�������������C���sT���d�|�_�d�|�_d|�_d|�_d|�_d|�_dg|�_d|�_d�|�_d�|�_ d|�_ d�|�_d�|�_d�S�)N����r���Zgztar) �template�manifest�use_defaultsr'���� manifest_onlyZforce_manifestr���� keep_temp�dist_dir� archive_filesr����owner�group)r���r���r���r����initialize_options`���s����zsdist.initialize_optionsc�������������C���sZ���|�j�d�krd|�_�|�jd�kr d|�_|�jd��tj|�j�}|rFtd|���|�jd�krVd|�_d�S�)NZMANIFESTzMANIFEST.inr���zunknown archive format '%s'Zdist)rC���rB���Zensure_string_listr ���Zcheck_archive_formatsr���ZDistutilsOptionErrorrG���)r���Z bad_formatr���r���r����finalize_optionsw���s���� zsdist.finalize_optionsc�������������C���sB���t���|�_x|�j��D�]}|�j|��qW�|�j���|�jr6d�S�|�j���d�S�)N)r����filelistZget_sub_commandsZrun_command� get_file_listrE����make_distribution)r���Zcmd_namer���r���r����run����s����z sdist.runc�������������C���s*���t�dt��|�jjd�}|j���|j���dS�)zDeprecated API.zadistutils.command.sdist.check_metadata is deprecated, use the check command insteadr@���N)r����PendingDeprecationWarning�distributionZget_command_objZensure_finalizedrP���)r���r@���r���r���r����check_metadata����s ����zsdist.check_metadatac�������������C���s����t�jj|�j�}|�r<|�j��r<|�j���|�jj���|�jj���dS�|sP|�j d|�j���|�jj ���|�jrh|�j���|rt|�j ���|�jr�|�j���|�jj���|�jj���|�j���dS�)aC��Figure 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)z?manifest template '%s' does not exist (using default file list))�os�path�isfilerB����_manifest_is_not_generated� read_manifestrM���r���Zremove_duplicatesr����findallrD����add_defaults� read_templater'����prune_file_list�write_manifest)r���Ztemplate_existsr���r���r���rN�������s(���� zsdist.get_file_listc�������������C���s2��d|�j�jg}x�|D�]�}t|t�rn|}d}x*|D�]"}tjj|�r.d}|�jj|��P�q.W�|s�|�j ddj |����qtjj|�r�|�jj|��q|�j d|���qW�dd g}x*|D�]"}ttjjt |��}|�jj|��q�W�|�jd �}|�j�j��r�|�jj|j����x>|jD�]4\} } }}x$|D�]} |�jjtjj | | ����qW���q�W�|�j�j���r�x||�j�jD�]p}t|t��r|t|�}tjj|��r�|�jj|��n:|\}}x0|D�](}t|�}tjj|��r�|�jj|���q�W��qHW�|�j�j���r�|�jd�}|�jj|j����|�j�j���r|�jd�}|�jj|j����|�j�j���r.|�jd �}|�jj|j����dS�)a9��Add 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)r^���r_���)rR���Zscript_name� isinstance�tuplerT���rU����existsrM���r���r����join�filterrV���r����extend�get_finalized_commandZhas_pure_modulesZget_source_filesZ data_filesZhas_data_files�strr ���Zhas_ext_modulesZhas_c_librariesZhas_scripts)r���Z standards�fnZaltsZgot_itZoptional�pattern�filesr`���ZpkgZsrc_dirZ build_dir� filenames�filename�item�dirnamer/���ra���rb���rc���r���r���r���rZ�������s\���� " zsdist.add_defaultsc�������������C���s����t�jd|�j��t|�jddddddd�}zlxf|j��}|dkr<P�y|�jj|��W�q*�ttfk r��}�z|�j d|j |j|f���W�Y�dd}~X�q*X�q*W�W�d|j���X�dS�)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'rA���)Zstrip_commentsZskip_blanksZ join_linesZ lstrip_wsZ rstrip_wsZ collapse_joinNz%s, line %d: %s) r����inforB���r ����readlinerM���Zprocess_template_lineZDistutilsTemplateError� ValueErrorr���rp���Zcurrent_line�close)r���rB����line�msgr���r���r���r[�����s ���� $zsdist.read_templatec�������������C���s����|�j�d�}|�jj��}|�jjd|jd��|�jjd|d��tjdkrFd}nd}ddd d ddd g}d|dj|�|f�}|�jj|dd��dS�)av��Prune 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)�prefixZwin32z/|\\�/ZRCSZCVSz\.svnz\.hgz\.gitz\.bzrZ_darcsz(^|%s)(%s)(%s).*�|rA���)Zis_regex) rj���rR����get_fullnamerM���Zexclude_patternZ build_base�sys�platformrg���)r���ry����base_dirZsepsZvcs_dirsZvcs_ptrnr���r���r���r\���:��s���� zsdist.prune_file_listc�������������C���sX���|�j���rtjd|�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'Nr���z*# file GENERATED by distutils, do NOT editzwriting manifest file '%s') rW���r���rs���rC���rM���rn����insertZexecuter���Z write_file)r���Zcontentr���r���r���r]���R��s���� zsdist.write_manifestc���������� ���C���s<���t�jj|�j�sdS�t|�j�}z|j��}W�d�|j���X�|dkS�)NFz+# file GENERATED by distutils, do NOT edit )rT���rU���rV���rC����openrt���rv���)r����fpZ first_liner���r���r���rW���a��s���� z sdist._manifest_is_not_generatedc�������������C���sX���t�jd|�j��t|�j�}x2|D�]*}|j��}|jd�s|�r<q|�jj|��qW�|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���rs���rC���r�����strip� startswithrM���r���rv���)r���rC���rw���r���r���r���rX���m��s���� zsdist.read_manifestc�������������C���s����|�j�|��tj|||�jd��ttd�r4d}d|�}nd}d|�}|sPtjd��n tj|��xD|D�]<}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)r����)Zmkpathr���Zcreate_treer�����hasattrrT���r���r���rs���rU���rV���rg���Z copy_filerR���ZmetadataZwrite_pkg_info)r���r����rn���r����rx����file�destr���r���r����make_release_tree|��s ���� zsdist.make_release_treec�������������C���s����|�j�j��}tjj|�j|�}|�j||�jj��g�}d|�j krT|�j j |�j j|�j jd����xD|�j D�]:}|�j ||||�j|�jd�}|j |��|�j�jj dd|f��q\W�||�_|�js�tj||�jd��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()'. Ztar)r����rI���rJ���r�����)r����N)rR���r}���rT���rU���rg���rG���r����rM���rn���r���r����pop�indexZmake_archiverI���rJ���Z dist_filesrH���rF���r���Zremove_treer����)r���r����Z base_namerH���Zfmtr����r���r���r���rO������s���� zsdist.make_distributionc�������������C���s���|�j�S�)zzReturn the list of archive files created when the command was run, or None if the command hasn't run yet. )rH���)r���r���r���r����get_archive_files���s����zsdist.get_archive_files)r���r���r���)r ���r!���r"���)r#���Nr$���)r%���Nr&���)r'���Nr(���)r)���Nr*���)r+���r,���r-���)r.���r/���r0���)r1���Nr2����@keep the distribution tree around after creating archive file(s))r3���r4���r����)r5���r6���r7���)r8���Nr9���)r:���r;���r<���)r=���r>���r?���)�__name__� __module__�__qualname__Zdescriptionr���Zuser_optionsZboolean_optionsr���Zhelp_optionsZnegative_optZsub_commandsrK���rL���rP���rS���rN���rZ���r[���r\���r]���rW���rX���r����rO���r����r���r���r���r���r���!���sj������������������ (P*r���)�__doc__rT���r~����typesr����warningsr���Zdistutils.corer���Z distutilsr���r���r���r ���Zdistutils.text_filer ���Zdistutils.errorsZdistutils.filelistr���r���Zdistutils.utilr ���r���r���r���r���r���r����<module>���s���