????
Your IP : 3.22.234.133
�
Ӱn�D0����dZddlZddlZddlmZddlmZddlmZddlm Z ddlm
Z
ddlmZdd lm
Z
dd
lmZddlmZddlmZdd
lmZmZd�ZGd�de��ZdS)zadistutils.command.sdist
Implements the Distutils 'sdist' command (create a source distribution).�N)�glob)�warn)�Command)�dir_util)� file_util)�archive_util)�TextFile)�FileList)�log)�convert_path)�DistutilsTemplateError�DistutilsOptionErrorc��ddlm}ddlm}g}|���D])}|�d|zd||df���*|���||���d��dS)zoPrint all possible values for the 'formats' option (used by
the "--help-formats" command-line option).
r)�FancyGetopt)�ARCHIVE_FORMATS�formats=N�z.List of available source distribution formats:)�distutils.fancy_getoptr�distutils.archive_utilr�keys�append�sort�
print_help)rr�formats�formats �>/opt/alt/python311/lib64/python3.11/distutils/command/sdist.py�show_formatsrs���3�2�2�2�2�2�6�6�6�6�6�6��G�!�&�&�(�(�5�5�����
�V�+�T�'��/��2�4� 5� 5� 5� 5��L�L�N�N�N��K����#�#�8�:�:�:�:�:�c���eZdZdZd�Zgd�Zgd�ZdddefgZdd d
�Z defgZ
dZd
�Zd�Z
d�Zd�Zd�Zd�Zed���Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Z d!�Z!d"�Z"dS)#�sdistz6create a source distribution (tarball, zip file, etc.)c��|jS)zYCallable used for the check sub-command.
Placed here so user_options can view it)�metadata_check��selfs r�checking_metadatazsdist.checking_metadata(s
���"�"r))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.r0r3zhelp-formatsNz#list available distribution formatsr(r*)r)r+�check)�READMEz
README.txtz
README.rstc��d|_d|_d|_d|_d|_d|_dg|_d|_d|_d|_ d|_
d|_d|_dS)N�r�gztar)
�template�manifest�use_defaultsr*�
manifest_only�force_manifestr� keep_temp�dist_dir�
archive_filesr"�owner�groupr#s r�initialize_optionszsdist.initialize_optionsesl����
���
������
��������y��������
�!��������
���
�
�
rc���|j�d|_|j�d|_|�d��tj|j��}|rt
d|z���|j� d|_dSdS)N�MANIFESTzMANIFEST.inrzunknown archive format '%s'�dist)r<r;�ensure_string_listr�check_archive_formatsrrrA)r$�
bad_formats r�finalize_optionszsdist.finalize_options|s����=� �&�D�M��=� �)�D�M���� �*�*�*�!�7���E�E�
�� >�&�/�*�<�>�>�
>��=� �"�D�M�M�M�!� rc���t��|_|���D]}|�|���|���|jrdS|���dS�N)r
�filelist�get_sub_commands�run_command�
get_file_listr>�make_distribution)r$�cmd_names r�runz sdist.run�s���!�
�
��
��-�-�/�/� '� '�H����X�&�&�&�&�
�������� ��F�
��� � � � � rc��tdt��|j�d��}|���|���dS)zDeprecated API.zadistutils.command.sdist.check_metadata is deprecated, use the check command insteadr6N)r�PendingDeprecationWarning�distribution�get_command_obj�ensure_finalizedrU)r$r6s r�check_metadatazsdist.check_metadata�sX���-�.G� I� I� I��!�1�1�'�:�:��
��� � � �
� � �����rc��tj�|j��}|s\|���rH|���|j���|j���dS|s|� d|jz��|j�
��|jr|���|r|�
��|jr|���|j���|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 (using default file list))�os�path�isfiler;�_manifest_is_not_generated�
read_manifestrOr�remove_duplicatesr�findallr=�add_defaults�
read_templater*�prune_file_list�write_manifest)r$�template_existss rrRzsdist.get_file_list�sI���'�.�.���7�7��� �4�#B�#B�#D�#D� ���� � � ��M��� � � ��M�+�+�-�-�-��F�� '��I�I�4��
�&�
'�
'�
'�
�
�������� �������� !���� � � ��:� #�� � �"�"�"��
�������
�'�'�)�)�)��������rc��|���|���|���|���|���|���|���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.
N)�_add_defaults_standards�_add_defaults_optional�_add_defaults_python�_add_defaults_data_files�_add_defaults_ext�_add_defaults_c_libs�_add_defaults_scriptsr#s rrdzsdist.add_defaults�s���
�$�$�&�&�&��#�#�%�%�%��!�!�#�#�#��%�%�'�'�'���� � � ��!�!�#�#�#��"�"�$�$�$�$�$rc���tj�|��sdStj�|��}tj�|��\}}|tj|��vS)z�
Case-sensitive path existence check
>>> sdist._cs_path_exists(__file__)
True
>>> sdist._cs_path_exists(__file__.upper())
False
F)r]r^�exists�abspath�split�listdir)�fspathrs� directory�filenames r�_cs_path_existszsdist._cs_path_exists�s_���w�~�~�f�%�%� ��5��'�/�/�&�)�)�� �g�m�m�G�4�4�� �8��2�:�i�0�0�0�0rc���|j|jjg}|D]�}t|t��rj|}d}|D]5}|�|��rd}|j�|��n�6|s+|�dd� |��z����|�|��r|j�|����|�d|z����dS)NFTz,standard file not found: should have one of z, zstandard file '%s' not found)
�READMESrX�script_name�
isinstance�tupleryrOrr�join)r$� standards�fn�alts�got_its rrjzsdist._add_defaults_standards�s���\�4�#4�#@�A� �� C� C�B��"�e�$�$�
C��������B��+�+�B�/�/��!%���
�,�,�R�0�0�0����
�/��I�I�L�"�i�i��o�o�.�/�/�/���'�'��+�+�C��M�(�(��,�,�,�,��I�I�<�r�A�B�B�B�B�# C� Crc��ddg}|D]H}ttjjt |����}|j�|���IdS)Nz
test/test*.pyz setup.cfg)�filterr]r^r_rrO�extend)r$�optional�pattern�filess rrkzsdist._add_defaults_optionalsW��#�[�1��� (� (�G��2�7�>�4��=�=�9�9�E��M� � ��'�'�'�'� (� (rc�R�|�d��}|j���r,|j�|�����|jD]D\}}}}|D]:}|j�tj �
||�����;�EdS)N�build_py)�get_finalized_commandrX�has_pure_modulesrOr��get_source_files�
data_filesrr]r^r)r$r��pkg�src_dir� build_dir� filenamesrxs rrlzsdist._add_defaults_pythons����-�-�j�9�9����-�-�/�/� >��M� � ��!:�!:�!<�!<�=�=�=�3;�2E� F� F�.�C��)�Y�%�
F�
F���
�$�$�R�W�\�\�'�8�%D�%D�E�E�E�E�
F� F� Frc��|j���r�|jjD]�}t|t��rIt|��}tj�|��r|j �
|���`|\}}|D]J}t|��}tj�|��r|j �
|���K��dSdSrN)rX�has_data_filesr�r}�strrr]r^r_rOr)r$�item�dirnamer�r/s rrmzsdist._add_defaults_data_files$s�����+�+�-�-�
4��)�4�
4�
4���d�C�(�(�4�'��-�-�D��w�~�~�d�+�+�3��
�,�,�T�2�2�2��*.�&�G�Y�&�4�4��(��O�O���7�>�>�!�,�,�4� �M�0�0��3�3�3��4�
4�
4�
4�
4rc��|j���rC|�d��}|j�|�����dSdS)N� build_ext)rX�has_ext_modulesr�rOr�r�)r$r�s rrnzsdist._add_defaults_ext5s^����,�,�.�.� ?��2�2�;�?�?�I��M� � ��!;�!;�!=�!=�>�>�>�>�>� ?� ?rc��|j���rC|�d��}|j�|�����dSdS)N�
build_clib)rX�has_c_librariesr�rOr�r�)r$r�s rrozsdist._add_defaults_c_libs:sa����,�,�.�.� @��3�3�L�A�A�J��M� � ��!<�!<�!>�!>�?�?�?�?�?� @� @rc��|j���rC|�d��}|j�|�����dSdS)N�
build_scripts)rX�has_scriptsr�rOr�r�)r$r�s rrpzsdist._add_defaults_scripts?sa����(�(�*�*� C� �6�6��G�G�M��M� � ��!?�!?�!A�!A�B�B�B�B�B� C� Crc ��tjd|j��t|jdddddd���} |���}|�n` |j�|��nC#ttf$r/}|� d|j
|j|fz��Yd}~nd}~wwxYw�w |���dS#|���wxYw)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'r9)�strip_comments�skip_blanks�
join_lines� lstrip_ws� rstrip_ws�
collapse_joinTNz%s, line %d: %s)
r�infor;r �readlinerO�process_template_liner
�
ValueErrorrrx�current_line�close)r$r;�line�msgs rrezsdist.read_templateDs(�� ��1�4�=�A�A�A��D�M�!��'(�A��*+�-�-�-�� �
9��(�(�*�*���<��9��M�7�7��=�=�=�=��/�
�;�9�9�9��I�I�/�8�3D�3;�3H�36�38�8�9�9�9�9�9�9�9�9�����9����
9��
�N�N�������H�N�N�������s5�C�A+�*C�+B+�<%B&�!C�&B+�+C�Cc��|�d��}|j���}|j�d|j���|j�d|���tjdkrd}nd}gd�}d|�d d
�|���d |�d�}|j�|d�
��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/|\\�/)�RCS�CVSz\.svnz\.hgz\.gitz\.bzr�_darcsz(^|z)(�|z).*r9)�is_regex) r�rX�get_fullnamerO�exclude_pattern�
build_base�sys�platformr)r$r��base_dir�seps�vcs_dirs�vcs_ptrns rrfzsdist.prune_file_listas����*�*�7�3�3���$�1�1�3�3���
�%�%�d�5�3C�%�D�D�D��
�%�%�d�8�%�<�<�<��<�7�"�"��D�D��D������*.�$�$�����0B�0B�0B�0B�D�D�D�I���
�%�%�h��%�;�;�;�;�;rc��|���rtjd|jz��dS|jjdd�}|�dd��|�tj |j|fd|jz��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`rr�r<rOr��insert�executer�
write_file)r$�contents rrgzsdist.write_manifestys���
�*�*�,�,� ��H�*�,0�M�:�
;�
;�
;��F��-�%�a�a�a�(�����q�F�G�G�G����Y�)�D�M�7�+C�1�D�M�A� C� C� C� C� Crc��tj�|j��sdSt |j��} |���}|���n#|���wxYw|dkS)NFz+# file GENERATED by distutils, do NOT edit
)r]r^r_r<�openr�r�)r$�fp�
first_lines rr`z sdist._manifest_is_not_generated�sm���w�~�~�d�m�,�,� ��5�
�$�-�
�
�� ������J��H�H�J�J�J�J��B�H�H�J�J�J�J�����K�K�Ks�A%�%A;c�,�tjd|j��t|j��5}|D]H}|���}|�d��s|s�.|j�|���I ddd��dS#1swxYwYdS)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)rr�r<r��strip�
startswithrOr)r$r<r�s rrazsdist.read_manifest�s���
��-�t�}�=�=�=�
�$�-�
�
� +�H� �
+�
+���z�z�|�|���?�?�3�'�'��t����
�$�$�T�*�*�*�*�
+� +� +� +� +� +� +� +� +� +� +� +� +���� +� +� +� +� +� +s�AB � B
�B
c�(�|�|��tj|||j���t t
d��rd}d|z}nd}d|z}|st
jd��nt
j|��|D]o}t
j �
|��st
jd|���7t
j �||��}|�|||� ���p|j
j�|��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�link�hardzmaking hard links in %s...Nzcopying files to %s...z)no files to distribute -- empty manifest?z#'%s' not a regular file -- skipping)r�)�mkpathr�create_treer��hasattrr]rrr�r^r_r� copy_filerX�metadata�write_pkg_info)r$r�r�r�r��file�dests r�make_release_treezsdist.make_release_tree�s��
���H������X�u�d�l�C�C�C�C��2�v��� 6��D�.��9�C�C��D�*�X�5�C�� ��H�@�A�A�A�A��H�S�M�M�M�� 6� 6�D��7�>�>�$�'�'�
6���>��E�E�E�E��w�|�|�H�d�3�3�����t�T���5�5�5�5���"�1�1�(�;�;�;�;�;rc��|j���}tj�|j|��}|�||jj��g}d|j vrJ|j �
|j �|j �d������|j D]]}|�
||||j|j���}|�
|��|jj�
dd|f���^||_|jst'j||j���dSdS)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()'.
�tar)r�rCrDr �r�N)rXr�r]r^rrAr�rOr�rr�pop�index�make_archiverCrD�
dist_filesrBr@r�remove_treer�)r$r�� base_namerB�fmtr�s rrSzsdist.make_distribution�sE���$�1�1�3�3���G�L�L����9�9� ����x���)<�=�=�=��
��D�L� � ��L����� 0� 0���1C�1C�E�1J�1J� K� K�L�L�L��<� E� E�C��$�$�Y��h�+/�:�T�Z�%�I�I�D�� � ��&�&�&���(�/�/��"�d�0C�D�D�D�D�*����~� A�� ��4�<�@�@�@�@�@�@� A� Arc��|jS)zzReturn the list of archive files created when the command
was run, or None if the command hasn't run yet.
)rBr#s r�get_archive_fileszsdist.get_archive_files�s
���!�!r)#�__name__�
__module__�__qualname__�descriptionr%�user_options�boolean_optionsr�help_options�negative_opt�sub_commandsr{rErLrUr[rRrd�staticmethodryrjrkrlrmrnrorprerfrgr`rar�rSr��rrr r $s�������J�K�#�#�#�%
�%
�%
�L�N6�6�6�O�
�� .�� >�
�L�
$2� '�*�*�L��/�0�1�L�4�G����.#�#�#� !�!�!�,���&�&�&�P%�%�%�,�1�1��\�1� C�C�C�*(�(�(�F�F�F� 4�4�4�"?�?�?�
@�@�@�
C�C�C�
���:<�<�<�0
C�
C�
C�
L�
L�
L�+�+�+�(<�(<�(<�TA�A�A�<"�"�"�"�"rr )�__doc__r]r�r�warningsr�distutils.corer� distutilsrrr�distutils.text_filer �distutils.filelistr
r�distutils.utilr�distutils.errorsr
rrr r�rr�<module>r�s>��L�L�
� � � �
�
�
�
�������������"�"�"�"�"�"�������������"�"�"�"�"�"�(�(�(�(�(�(�'�'�'�'�'�'�������'�'�'�'�'�'�I�I�I�I�I�I�I�I�:�:�:�J"�J"�J"�J"�J"�G�J"�J"�J"�J"�J"r