\bgyIdZddlZddlZddlmZmZmZddlmZddl m Z ddl m Z ddl m Z dd lmZmZdd lmZdd lmZdd lmZd ZGdde ZdZdS)zadistutils.command.sdist Implements the Distutils 'sdist' command (create a source distribution).N) archive_utildir_util file_util)log)glob) filterfalse)Command)DistutilsOptionErrorDistutilsTemplateError)FileList)TextFile) convert_pathcddlmddlm}t fdD}||ddS)zoPrint all possible values for the 'formats' option (used by the "--help-formats" command-line option). r )ARCHIVE_FORMATS) FancyGetoptc3@K|]}d|zd|dfVdS)formats=Nr ).0formatrs t/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py zshow_formats..sM  f dOF$;A$>?z.List of available source distribution formats:N)rr fancy_getoptrsortedkeys print_help)rformatsrs @r show_formatsr s/.....******%**,,GK##$TUUUUUrceZdZdZdZgdZgdZdddefgZdd d Z d efgZ d Z d Z dZ dZdZdZedZdZdZdZdZdZdZdZdZdZdZdZdZdZd 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_checkselfs rchecking_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)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-onlyozEjust regenerate the manifest and then stop (implies --force-manifest))force-manifestfzkforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.)rNz6formats for source distribution (comma-separated list)) keep-tempkz@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.r0r2r5z help-formatsNz#list available distribution formatsr*r,)r+r-check)READMEz README.txtz README.rstcd|_d|_d|_d|_d|_d|_dg|_d|_d|_d|_ d|_ d|_ d|_ dS)NTFgztar) templatemanifest use_defaultsr, manifest_onlyforce_manifestr keep_tempdist_dir archive_filesr$ownergroupr%s rinitialize_optionszsdist.initialize_optionswsl  ! "#y  !  rc|jd|_|jd|_|dtj|j}|rt d|d|j d|_dSdS)NMANIFESTz MANIFEST.inrzunknown archive format ''dist)r>r=ensure_string_listrcheck_archive_formatsrr rC)r& bad_formats rfinalize_optionszsdist.finalize_optionss = &DM = )DM  ***!7 EE  Q&'O*'O'O'OPP P = "DMMM ! rct|_|D]}||||jrdS|dSN)r filelistget_sub_commands run_command get_file_listr@make_distribution)r&cmd_names rrunz sdist.runs!  --// ' 'H   X & & & &     F      rctj|j}|s\|rH||j|jdS|s| d|jz|j |j r| |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))ospathisfiler=_manifest_is_not_generated read_manifestrRsortremove_duplicateswarnfindallr? add_defaults read_templater,prune_file_listwrite_manifest)r&template_existss rrUzsdist.get_file_listsG'..77 4#B#B#D#D     M   M + + - - - F  IIW-               !    : #  " " "  ''))) rc|||||||dS)aLAdd 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 rrczsdist.add_defaultss $$&&& ##%%% !!### %%'''     !!### ""$$$$$rctj|sdStj|}tj|\}}|tj|vS)z Case-sensitive path existence check >>> sdist._cs_path_exists(__file__) True >>> sdist._cs_path_exists(__file__.upper()) False F)rZr[existsabspathsplitlistdir)fspathrr directoryfilenames r_cs_path_existszsdist._cs_path_existss_w~~f%% 5'//&)) gmmG44 82:i0000rc|j|jjg}|D]}t|trj|}d}|D]5}||rd}|j|n6|s+|dd |z||r|j||d|ddS)NFTz,standard file not found: should have one of z, zstandard file 'z ' not found) READMES distribution script_name isinstancetuplerxrRappendrajoin)r& standardsfnaltsgot_its rrizsdist._add_defaults_standardss\4#4#@A  A AB"e$$ AB++B//!% ,,R000 IIFSWX''++AM((,,,,II????@@@@% A Arcgd}|D]H}ttjjt |}|j|IdS)N)ztests/test*.pyz test/test*.pyz setup.cfg)filterrZr[r\rrRextend)r&optionalpatternfiless rrjzsdist._add_defaults_optionalsXCCC ( (G27>4==99E M  ' ' ' ' ( (rcR|d}|jr,|j||jD]D\}}}}|D]:}|jtj ||;EdS)Nbuild_py) get_finalized_commandr{has_pure_modulesrRrget_source_files data_filesrrZr[r)r&r_pkgsrc_dir _build_dir filenamesrws rrkzsdist._add_defaults_pythons--j99   - - / / > M !:!:!>!,,4 M003334 4 4 4 4rc|jrC|d}|j|dSdS)N build_ext)r{has_ext_modulesrrRrr)r&rs rrmzsdist._add_defaults_ext@s^   , , . . ?22;??I M !;!;!=!= > > > > > ? ?rc|jrC|d}|j|dSdS)N build_clib)r{has_c_librariesrrRrr)r&rs rrnzsdist._add_defaults_c_libsEsa   , , . . @33LAAJ M !!> ? ? ? ? ? @ @rc|jrC|d}|j|dSdS)N build_scripts)r{ has_scriptsrrRrr)r&rs rrozsdist._add_defaults_scriptsJsa   ( ( * * C 66GGM M !?!?!A!A B B B B B C Crc tjd|jt|jdddddd} |}|n` |j|nC#ttf$r/}| d|j |j |fzYd}~nd}~wwxYww | dS#| wxYw)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. zreading manifest template '%s'T)strip_comments skip_blanks join_lines lstrip_ws rstrip_ws collapse_joinNz%s, line %d: %s) rinfor=rreadlinerRprocess_template_liner ValueErrorrarw current_lineclose)r&r=linemsgs rrdzsdist.read_templateOs+ 14=AAA M     ((**< M77====/ ;II)#,h.CSIJ  NN     HNN    s5CA+*C+B+<%B&!C&B++CCc|d}|j}|jdt j|j|jd|tj dkrd}nd}gd}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)prefixwin32z/|\\/)RCSCVSz\.svnz\.hgz\.gitz\.bzr_darcsz(^|{})({})({}).*|T)is_regex) rr{ get_fullnamerRexclude_patternrZru build_basesysplatformrr)r&rbase_dirsepsvcs_dirsvcs_ptrns rrezsdist.prune_file_listss**733$1133 %%d29U=M3N3N%OOO %%d8%<<< <7 " "DDDRRR&--dCHHX4F4FMM %%h%>>>>>rc"|rtjd|jddS|jjdd}|dd|tj |j|fd|jddS)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 'rJNrz*# file GENERATED by distutils, do NOT editzwriting manifest file ') r]rrr>rRrinsertexecuter write_file)r&contents rrfzsdist.write_manifests  * * , ,  HUT]UUU    F-%aaa(qFGGG  ]G $ 6dm 6 6 6     rctj|jsdSt |jd5}t |}dddn #1swxYwY|dkS)NFutf-8encodingz+# file GENERATED by distutils, do NOT edit )rZr[r\r>opennext)r&fp first_lines rr]z sdist._manifest_is_not_generatedsw~~dm,, 5 $-' 2 2 2 "bbJ " " " " " " " " " " " " " " "KKKsAA Ac >tjd|jt|jd5}|jt dttttj |ddddS#1swxYwYdS)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. zreading manifest file '%s'rrN) rrr>rrRrrr is_commentmaprstrip)r&liness rr^zsdist.read_manifests -t}=== $-' 2 2 2 e M t[SE5J5JKKLL                     sABBBc,||tj|||jt t dr d}d|d}nd}d|d}|st jdnt j||D]o}t j |st jd |7t j ||}| ||| p|j j|dS) aCreate 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_runlinkhardzmaking hard links in z...Nzcopying files to z)no files to distribute -- empty manifest?z#'%s' not a regular file -- skipping)r)mkpathr create_treerhasattrrZrwarningrr[r\r copy_filer{metadatawrite_pkg_info)r&rrrrfiledests rmake_release_treezsdist.make_release_trees$ HXudlCCCC 2v   4D7(777CCD3h333C  KC D D D D HSMMM 6 6D7>>$'' 6 A4HHHHw||Hd33tT5555 "11(;;;;;rc|j}tj|j|}|||jjg}d|j vrJ|j |j |j d|j D]]}| ||||j|j}| ||jj dd|f^||_|jst'j||jdSdS)aCreate 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)rrErFr"rN)r{rrZr[rrCrrRrrrpopindex make_archiverErF dist_filesrDrBr remove_treer)r&r base_namerDfmtrs rrVzsdist.make_distributionsE$1133GLL99  x)<=== DL L   0 01C1CE1J1J K K L L L< E EC$$34:%D   & & &   ( / /"d0C 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. )rDr%s rget_archive_fileszsdist.get_archive_filess !!r)"__name__ __module__ __qualname__ descriptionr' user_optionsboolean_optionsr help_options negative_opt sub_commandsrzrGrOrXrUrc staticmethodrxrirjrkrlrmrnrordrerfr]r^rrVrrrrr"r"!sJK### 888LtO DlSL$2wGGL/01L4G. # # #!!!,'''R%%%,11\1 AAA,((( FFF 444"??? @@@ CCC """H???.   &LLL   (<(<("""""rr"c,|dS)N#) startswith)rs rrrs ??3  r)__doc__rZr distutilsrrrdistutils._logrr itertoolsrcorer errorsr r rRr text_filerutilrr r"rrrrrs7LL 7777777777!!!!!!AAAAAAAA  V V V^"^"^"^"^"G^"^"^"B     r