zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
U
G=®d=Jã@s¸dZddlZddlZddlmZddlmZddlmZddlm    Z    ddlm
Z
ddlm Z dd    l m Z dd
lmZdd lmZdd lmZdd lmZmZdd„ZGdd„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ÚDistutilsOptionErrorcCs`ddlm}ddlm}g}| ¡D] }| d|d||df¡q$| ¡||ƒ 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_getoptrZdistutils.archive_utilrÚkeysÚappendÚsortÚ
print_help)rrÚformatsÚformat©rúZD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/_distutils/command/sdist.pyÚ show_formatss    
ÿÿrc@s"eZdZdZdd„Zdddddd    d
d d d ddddgZddddddgZdddefgZdddœZ    defgZ
dZ dd„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)zYCallable used for the check sub-command.
 
        Placed here so user_options can view it)Ú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érÚgztar) Ú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)NZMANIFESTz MANIFEST.inrzunknown archive format '%s'Údist)r5r4Úensure_string_listrÚcheck_archive_formatsrr r9)rZ
bad_formatrrrÚfinalize_options|s
 
 
 ÿ
zsdist.finalize_optionscCs>tƒ|_| ¡D]}| |¡q| ¡|jr2dS| ¡dS©N)r    ÚfilelistÚget_sub_commandsÚ run_commandÚ get_file_listr7Úmake_distribution)rÚcmd_namerrrÚrunŒs  z    sdist.runcCs*tdtƒ|j d¡}| ¡| ¡dS)zDeprecated API.zadistutils.command.sdist.check_metadata is deprecated,               use the check command insteadr1N)rÚPendingDeprecationWarningÚ distributionÚget_command_objÚensure_finalizedrI)rr1rrrÚcheck_metadata¢s ÿ zsdist.check_metadatacCs tj |j¡}|s:| ¡r:| ¡|j ¡|j ¡dS|sN|     d|j¡|j 
¡|j rf|  ¡|rr|  ¡|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Úisfiler4Ú_manifest_is_not_generatedÚ read_manifestrCrZremove_duplicatesrÚfindallr6Ú add_defaultsÚ read_templater%Úprune_file_listÚwrite_manifest)rZtemplate_existsrrrrFªs( 
 
þ
 
 
zsdist.get_file_listcCs<| ¡| ¡| ¡| ¡| ¡| ¡| ¡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_scriptsrrrrrUÒszsdist.add_defaultscCs:tj |¡sdStj |¡}tj |¡\}}|t |¡kS)z±
        Case-sensitive path existence check
 
        >>> sdist._cs_path_exists(__file__)
        True
        >>> sdist._cs_path_exists(__file__.upper())
        False
        F)rOrPÚexistsÚabspathÚsplitÚlistdir)ÚfspathraÚ    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)
ÚREADMESrKÚ script_nameÚ
isinstanceÚtuplergrCrrÚjoin)rZ    standardsÚfnZaltsZgot_itrrrrYùs"
 
 ÿ
zsdist._add_defaults_standardscCs4ddg}|D]"}ttjjt|ƒƒ}|j |¡q dS)Nz test/test*.pyz    setup.cfg)ÚfilterrOrPrQrrCÚextend)rÚoptionalÚpatternÚfilesrrrrZszsdist._add_defaults_optionalcCs\| d¡}|j ¡r$|j | ¡¡|jD],\}}}}|D]}|j tj     
||¡¡q:q*dS)NÚbuild_py) Úget_finalized_commandrKÚhas_pure_modulesrCroÚget_source_filesÚ
data_filesrrOrPrl)rrsÚpkgÚsrc_dirÚ    build_dirÚ    filenamesrfrrrr[s 
 
zsdist._add_defaults_pythoncCsz|j ¡rv|jjD]b}t|tƒrBt|ƒ}tj |¡rt|j     
|¡q|\}}|D]$}t|ƒ}tj |¡rN|j     
|¡qNqdSrB) rKÚhas_data_filesrwrjÚstrr rOrPrQrCr)rÚitemÚdirnamer{r*rrrr\$s
 
  zsdist._add_defaults_data_filescCs(|j ¡r$| d¡}|j | ¡¡dS)NÚ    build_ext)rKÚhas_ext_modulesrtrCrorv)rr€rrrr]5s
 
zsdist._add_defaults_extcCs(|j ¡r$| d¡}|j | ¡¡dS)NÚ
build_clib)rKÚhas_c_librariesrtrCrorv)rr‚rrrr^:s
 
zsdist._add_defaults_c_libscCs(|j ¡r$| d¡}|j | ¡¡dS)NÚ build_scripts)rKÚ has_scriptsrtrCrorv)rr„rrrr_?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)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'r2)Ústrip_commentsÚ skip_blanksÚ
join_linesÚ    lstrip_wsÚ    rstrip_wsZ collapse_joinNz%s, line %d: %s) r
Úinfor4rÚcloseÚreadlinerCÚprocess_template_liner Ú
ValueErrorrrfÚ current_line)rr4ÚlineÚmsgrrrrVDs&
þ
þ zsdist.read_templatecCs„| d¡}|j ¡}|jjd|jd|jjd|dtjdkrFd}nd}ddd    d
d d d g}d|d |¡|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).*ú|r2)Zis_regex)    rtrKÚ get_fullnamerCZexclude_patternÚ
build_baseÚsysÚplatformrl)rr“Úbase_dirÚsepsZvcs_dirsZvcs_ptrnrrrrWas
 
 
 ÿzsdist.prune_file_listcCsX| ¡rt d|j¡dS|jjdd…}| dd¡| tj    |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')
rRr
r‹r5rCrrÚinsertÚexecuterÚ
write_file)rÚcontentrrrrXysÿ ÿzsdist.write_manifestcCs<tj |j¡sdSt|jƒ}z | ¡}W5| ¡X|dkS)NFz+# file GENERATED by distutils, do NOT edit
)rOrPrQr5ÚopenrŒr)rÚfpÚ
first_linerrrrRˆs
 
z sdist._manifest_is_not_generatedc    CsVt d|j¡t|jƒ4}|D](}| ¡}| d¡s|s:q|j |¡qW5QRXdS)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
r‹r5r¢ÚstripÚ
startswithrCr)rr5r‘rrrrS”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)
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©ÚhasattrrOr
rr‹rPrQrlÚ    copy_filerKÚmetadataÚwrite_pkg_info)rrœrrrªr’Ú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)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œr;r<rÚr¨N)rKr˜rOrPrlr9r´rCrrrrÚpopÚindexÚ make_archiver;r<Ú
dist_filesr:r8rÚ remove_treer©)rrœÚ    base_namer:Úfmtr²rrrrGÌ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.
        )r:rrrrÚget_archive_filesêszsdist.get_archive_files)#Ú__name__Ú
__module__Ú __qualname__Ú descriptionr Ú user_optionsÚboolean_optionsrÚ help_optionsÚ negative_optÚ sub_commandsrhr=rArIrNrFrUÚ staticmethodrgrYrZr[r\r]r^r_rVrWrXrRrSr´rGr¾rrrrr$spÝ'þÿÿÿ
(
 *r)Ú__doc__rOršrÚwarningsrÚdistutils.corerÚ    distutilsrrrÚdistutils.text_filerÚdistutils.filelistr    r
Údistutils.utilr Údistutils.errorsr r rrrrrrÚ<module>s