
    vKgyI                         S r SSKrSSKrSSKJrJrJr  SSKJr  SSK	J	r	  SSK
Jr  SSKJr  SS	KJrJr  SS
KJr  SSKJr  SSKJr  S r " S S\5      rS rg)zadistutils.command.sdist

Implements the Distutils 'sdist' command (create a source distribution).    N)archive_utildir_util	file_util)log)glob)filterfalse   )Command)DistutilsOptionErrorDistutilsTemplateError)FileList)TextFile)convert_pathc                     ^ SSK Jm  SSKJn   [	        U4S jTR                  5        5       5      nU " U5      R                  S5        g)zgPrint all possible values for the 'formats' option (used by
the "--help-formats" command-line option).
r	   )ARCHIVE_FORMATS)FancyGetoptc              3   >   >#    U H  nS U-   STU   S   4v   M     g7f)formats=Nr	    ).0formatr   s     c/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/_distutils/command/sdist.py	<genexpr>show_formats.<locals>.<genexpr>   s.      ,F 
f	dOF$;A$>?,s   z.List of available source distribution formats:N)r   r   fancy_getoptr   sortedkeys
print_help)r   formatsr   s     @r   show_formatsr       sA     /* %**, G ##$TU    c                       \ rS rSrSrS r/ SQr/ SQrSSS\4/r	S	S
S.r
S\4/rSrS rS rS rS rS r\S 5       rS rS rS rS rS rS rS rS rS rS rS rS rS  r S! r!S" r"S#r#g)$sdist!   z6create a source distribution (tarball, zip file, etc.)c                     U R                   $ )zQCallable used for the check sub-command.

Placed here so user_options can view it)metadata_checkselfs    r   checking_metadatasdist.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)pruneNzspecifically 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.)r   Nz6formats 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])zowner=uz@Owner name used when creating a tar file [default: current user])zgroup=gzAGroup name used when creating a tar file [default: current group])r-   r/   r1   r3   r5   r8   zhelp-formatsNz#list available distribution formatsr-   r/   )r.   r0   check)READMEz
README.txtz
README.rstc                     S U l         S U l        SU l        SU l        SU l        SU l        S/U l        SU l        S U l        S U l	        SU l
        S U l        S U l        g )NTFgztar   )templatemanifestuse_defaultsr/   manifest_onlyforce_manifestr   	keep_tempdist_dirarchive_filesr&   ownergroupr'   s    r   initialize_optionssdist.initialize_optionsw   sh      !
"#y!

r!   c                    U R                   c  SU l         U R                  c  SU l        U R                  S5        [        R                  " U R
                  5      nU(       a  [        SU S35      eU R                  c  SU l        g g )NMANIFESTzMANIFEST.inr   zunknown archive format ''dist)rA   r@   ensure_string_listr   check_archive_formatsr   r   rF   )r(   
bad_formats     r   finalize_optionssdist.finalize_options   st    == &DM== )DM	*!77E
&)A*Q'OPP== "DM !r!   c                     [        5       U l        U R                  5        H  nU R                  U5        M     U R	                  5         U R
                  (       a  g U R                  5         g N)r   filelistget_sub_commandsrun_commandget_file_listrC   make_distribution)r(   cmd_names     r   run	sdist.run   sZ     !
 --/HX& 0 	  	 r!   c                    [         R                  R                  U R                  5      nU(       dZ  U R	                  5       (       aE  U R                  5         U R                  R                  5         U R                  R                  5         gU(       d  U R                  SU R                  -  5        U R                  R                  5         U R                  (       a  U R                  5         U(       a  U R                  5         U R                  (       a  U R                  5         U R                  R                  5         U R                  R                  5         U R!                  5         g)a  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 (using default file list))ospathisfiler@   _manifest_is_not_generatedread_manifestrW   sortremove_duplicateswarnfindallrB   add_defaultsread_templater/   prune_file_listwrite_manifest)r(   template_existss     r   rZ   sdist.get_file_list   s     ''..74#B#B#D#D MM MM++-IIW--  	 ::  "'')r!   c                     U R                  5         U R                  5         U R                  5         U R                  5         U R	                  5         U R                  5         U R                  5         g)a  Add all the default files to self.filelist:
  - README or README.txt
  - setup.py
  - tests/test*.py and 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    r   ri   sdist.add_defaults   sX     	$$&##%!!#%%' !!#""$r!   c                     [         R                  R                  U 5      (       d  g[         R                  R                  U 5      n[         R                  R	                  U5      u  p#U[         R
                  " U5      ;   $ )z
Case-sensitive path existence check

>>> sdist._cs_path_exists(__file__)
True
>>> sdist._cs_path_exists(__file__.upper())
False
F)r`   ra   existsabspathsplitlistdir)fspathrz   	directoryfilenames       r   _cs_path_existssdist._cs_path_exists   sU     ww~~f%%''//&) ggmmG4	2::i000r!   c                    U R                   U R                  R                  /nU H  n[        U[        5      (       ap  UnSnU H8  nU R                  U5      (       d  M  SnU R                  R                  U5          O   U(       d%  U R                  SSR                  U5      -   5        M  M  U R                  U5      (       a  U R                  R                  U5        M  U R                  SU S35        M     g )NFTz,standard file not found: should have one of z, zstandard file 'z' not found)
READMESdistributionscript_name
isinstancetupler   rW   appendrg   join)r(   	standardsfnaltsgot_its        r   rp   sdist._add_defaults_standards  s    \\4#4#4#@#@A	B"e$$B++B//!%,,R0	  IIFSWX 
 ''++MM((,IIt;?@% r!   c                     / SQnU HK  n[        [        R                  R                  [	        U5      5      nU R
                  R                  U5        MM     g )N)ztests/test*.pyztest/test*.pyz	setup.cfg)filterr`   ra   rb   r   rW   extend)r(   optionalpatternfiless       r   rq   sdist._add_defaults_optional  s;    CG277>>4=9EMM  '  r!   c                 d   U R                  S5      nU R                  R                  5       (       a)  U R                  R	                  UR                  5       5        UR                   HG  u  p#pEU H;  nU R                  R                  [        R                  R                  X65      5        M=     MI     g )Nbuild_py)get_finalized_commandr   has_pure_modulesrW   r   get_source_files
data_filesr   r`   ra   r   )r(   r   _pkgsrc_dir
_build_dir	filenamesr   s          r   rr   sdist._add_defaults_python  s     --j9 --//MM  !:!:!<= 5=4G4G0D:%$$RWW\\'%DE & 5Hr!   c                    U R                   R                  5       (       a  U R                   R                   H  n[        U[        5      (       aN  [        U5      n[        R                  R                  U5      (       a  U R                  R                  U5        Md  Mf  Uu  p#U HO  n[        U5      n[        R                  R                  U5      (       d  M4  U R                  R                  U5        MQ     M     g g rV   )r   has_data_filesr   r   strr   r`   ra   rb   rW   r   )r(   itemdirnamer   r4   s        r   rs   sdist._add_defaults_data_files/  s    ++--))44dC(('-Dww~~d++,,T2 , *.&G&(O77>>!,, MM003 ' 5 .r!   c                     U R                   R                  5       (       a;  U R                  S5      nU R                  R	                  UR                  5       5        g g )N	build_ext)r   has_ext_modulesr   rW   r   r   )r(   r   s     r   rt   sdist._add_defaults_ext@  sG    ,,..22;?IMM  !;!;!=> /r!   c                     U R                   R                  5       (       a;  U R                  S5      nU R                  R	                  UR                  5       5        g g )N
build_clib)r   has_c_librariesr   rW   r   r   )r(   r   s     r   ru   sdist._add_defaults_c_libsE  sG    ,,..33LAJMM  !<!<!>? /r!   c                     U R                   R                  5       (       a;  U R                  S5      nU R                  R	                  UR                  5       5        g g )Nbuild_scripts)r   has_scriptsr   rW   r   r   )r(   r   s     r   rv   sdist._add_defaults_scriptsJ  sG    ((** 66GMMM  !?!?!AB +r!   c           
         [         R                  " SU R                  5        [        U R                  SSSSSSS9n  UR	                  5       nUc  O U R
                  R                  U5        M2  UR                  5         g! [        [        4 a5  nU R                  SUR                  UR                  U4-  5         SnANSSnAff = f! UR                  5         f = f)zRead 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.
zreading manifest template '%s'T)strip_commentsskip_blanks
join_lines	lstrip_ws	rstrip_wscollapse_joinNz%s, line %d: %s)r   infor@   r   readlinerW   process_template_liner   
ValueErrorrg   r   current_lineclose)r(   r@   linemsgs       r   rj   sdist.read_templateO  s     	14==AMM
	((*<	MM77=   NN /
; II)#,,h.C.CSIJ  NNs5   C B  -C  C+C ;C  CC Cc                    U R                  S5      nU R                  R                  5       nU R                  R	                  S[
        R                  " UR                  5      S9  U R                  R	                  SUS9  [        R                  S:X  a  SnOSn/ SQnSR                  US	R                  U5      U5      nU R                  R	                  US
S9  g)aF  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)prefixwin32z/|\\/)RCSCVSz\.svnz\.hgz\.gitz\.bzr_darcsz(^|{})({})({}).*|T)is_regex)r   r   get_fullnamerW   exclude_patternr`   r}   
build_basesysplatformr   r   )r(   r   base_dirsepsvcs_dirsvcs_ptrns         r   rk   sdist.prune_file_lists  s     **73$$113%%d299U=M=M3N%O%%d8%<<<7"DDR&--dCHHX4FM%%h%>r!   c                 D   U R                  5       (       a%  [        R                  " SU R                   S35        gU R                  R
                  SS nUR                  SS5        U R                  [        R                  U R                  U4SU R                   S35        g)zWrite the file list in 'self.filelist' (presumably as filled in
by 'add_defaults()' and 'read_template()') to the manifest file
named by 'self.manifest'.
z2not writing to manually maintained manifest file 'rN   Nr   z*# file GENERATED by distutils, do NOT editzwriting manifest file ')
rc   r   r   rA   rW   r   insertexecuter   
write_file)r(   contents     r   rl   sdist.write_manifest  s    
 **,,HHDT]]OSTU --%%a(qFG  ]]G$%dmm_A6	
r!   c                     [         R                  R                  U R                  5      (       d  g[	        U R                  SS9 n[        U5      nS S S 5        US:g  $ ! , (       d  f       WS:g  $ = f)NFutf-8encodingz+# file GENERATED by distutils, do NOT edit
)r`   ra   rb   rA   opennext)r(   fp
first_lines      r   rc    sdist._manifest_is_not_generated  s[    ww~~dmm,,$--'2bbJ 3KKK 32KKKs   A
A/c                 8   [         R                  " SU R                  5        [        U R                  SS9 nU R                  R                  [        S[        [        [        [        R                  U5      5      5      5        SSS5        g! , (       d  f       g= f)zRead 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.
zreading manifest file '%s'r   r   N)r   r   rA   r   rW   r   r   r   
is_commentmapr   strip)r(   liness     r   rd   sdist.read_manifest  sa    
 	-t}}=$--'2eMM  t[SE5JKL 322s   AB
Bc                 L   U R                  U5        [        R                  " XU R                  S9  [	        [
        S5      (       a	  SnSU S3nOSnSU S3nU(       d  [        R                  " S5        O[        R                  " U5        U Ho  n[
        R                  R                  U5      (       d  [        R                  " S	U5        M@  [
        R                  R                  X5      nU R                  XVUS
9  Mq     U R                  R                  R                  U5        g)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hardzmaking hard links in z...Nzcopying files to z)no files to distribute -- empty manifest?z#'%s' not a regular file -- skipping)r   )mkpathr   create_treer   hasattrr`   r   warningr   ra   rb   r   	copy_filer   metadatawrite_pkg_info)r(   r   r   r   r   filedests          r   make_release_treesdist.make_release_tree  s     	HXdllC 2vD)(37CD%hZs3CKKCDHHSMD77>>$''A4Hww||H3t5  	""11(;r!   c           	         U R                   R                  5       n[        R                  R	                  U R
                  U5      nU R                  XR                  R                  5        / nSU R                  ;   aM  U R                  R                  U R                  R                  U R                  R                  S5      5      5        U R                   Ha  nU R                  X$XR                  U R                  S9nUR                  U5        U R                   R                   R                  SSU45        Mc     X0l        U R$                  (       d  [&        R(                  " XR*                  S9  gg)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   rH   rI   r#    r   N)r   r   r`   ra   r   rF   r   rW   r   r   r   popindexmake_archiverH   rI   
dist_filesrG   rE   r   remove_treer   )r(   r   	base_namerG   fmtr   s         r   r[   sdist.make_distribution  s    $$113GGLL9	x)<)<=DLL LL 0 01C1CE1J KL<<C$$4:: % D   &((//"d0CD   +~~  <<@ r!   c                     U R                   $ )zjReturn the list of archive files created when the command
was run, or None if the command hasn't run yet.
)rG   r'   s    r   get_archive_filessdist.get_archive_files  s     !!!r!   )rG   rF   rW   rD   r   rI   rE   rA   rC   r&   rH   r/   r@   rB   )$__name__
__module____qualname____firstlineno__descriptionr)   user_optionsboolean_optionsr    help_optionsnegative_optsub_commandsr   rJ   rS   r]   rZ   ri   staticmethodr   rp   rq   rr   rs   rt   ru   rv   rj   rk   rl   rc   rd   r   r[   r  __static_attributes__r   r!   r   r#   r#   !   s    JK#8LtO 
DlSL $2wGL/01L4G.#!,'R%, 1 1 A,(F 4"?
@
C
"H?.
&L
(<TA>"r!   r#   c                 $    U R                  S5      $ )N#)
startswith)r   s    r   r   r     s    ??3r!   )__doc__r`   r   	distutilsr   r   r   distutils._logr   r   	itertoolsr   corer
   errorsr   r   rW   r   	text_filer   utilr   r    r#   r   r   r!   r   <module>r!     sK   L 
 
 7 7   !  A    V^"G ^"B r!   