3 \E@sddlZddlZddlTddlmZddlmZddlmZddlm Z m Z m Z m Z ddl mZddlTddlmZdd lmZdd lmZd d ZGd ddeZdS)N)*)glob)warn)Command)dir_utildep_util file_util archive_util)TextFile)FileList)log) convert_pathcCsdddlm}ddlm}g}x,|jD] }|jd|d||dfq&W|j||jddS)Nr) FancyGetopt)ARCHIVE_FORMATSzformats=z.List of available source distribution formats:)Zdistutils.fancy_getoptrZdistutils.archive_utilrkeysappendsortZ print_help)rrformatsformatr//usr/lib64/python3.6/distutils/command/sdist.py show_formatss   rc@seZdZdZddZdJdKdLdMdNdOdPdQdRdTdUdVdWdXgZd ddddd"gZd*d d+efgZd dd,Z d-efgZ d.d/Z d0d1Z d2d3Z d4d5Zd6d7Zd8d9Zd:d;Zdd?Zd@dAZdBdCZdDdEZdFdGZdHdIZd S)Ysdistz6create a source distribution (tarball, zip file, etc.)cCs|jS)N)metadata_check)selfrrrchecking_metadata%szsdist.checking_metadata template=t5name of manifest template file [default: MANIFEST.in] manifest=m)name of manifest file [default: MANIFEST] use-defaultsNRinclude the default file set in the manifest [default; disable with --no-defaults] no-defaults"don't include the default file setprunespecifically 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-onlyoEjust regenerate the manifest and then stop (implies --force-manifest)force-manifestfkforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.formats=6formats for source distribution (comma-separated list) keep-tempkz1keep the distribution tree around after creating zarchive file(s) dist-dir=dFdirectory 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=gAGroup name used when creating a tar file [default: current group]z help-formatsz#list available distribution formats)z no-defaultszno-prunecheckcCsTd|_d|_d|_d|_d|_d|_dg|_d|_d|_d|_ d|_ d|_ d|_ dS)NrZgztar) templatemanifest use_defaultsr' manifest_onlyZforce_manifestr keep_tempdist_dir archive_filesrownergroup)rrrrinitialize_options`szsdist.initialize_optionscCsZ|jdkrd|_|jdkr d|_|jdtj|j}|rFtd||jdkrVd|_dS)NZMANIFESTz MANIFEST.inrzunknown archive format '%s'Zdist)rCrBZensure_string_listr Zcheck_archive_formatsrZDistutilsOptionErrorrG)rZ bad_formatrrrfinalize_optionsws      zsdist.finalize_optionscCsBt|_x|jD]}|j|qW|j|jr6dS|jdS)N)r filelistZget_sub_commandsZ run_command get_file_listrEmake_distribution)rZcmd_namerrrrunsz sdist.runcCs*tdt|jjd}|j|jdS)Nzadistutils.command.sdist.check_metadata is deprecated, use the check command insteadr@)rPendingDeprecationWarning distributionZget_command_objZensure_finalizedrP)rr@rrrcheck_metadatas  zsdist.check_metadatacCstjj|j}| r<|jr<|j|jj|jjdS|sP|j d|j|jj |j rh|j |rt|j |jr|j|jj|jj|jdS)Nz&manifest template '%s' does not exist z(using default file list)z?manifest template '%s' does not exist (using default file list))ospathisfilerB_manifest_is_not_generated read_manifestrMrZremove_duplicatesrfindallrD add_defaults read_templater'prune_file_listwrite_manifest)rZtemplate_existsrrrrNs(      zsdist.get_file_listcCs2d|jjg}x|D]}t|trn|}d}x*|D]"}tjj|r.d}|jj|Pq.W|s|j ddj |qtjj|r|jj|q|j d|qWdd g}x*|D]"}t tjj t |}|jj|qW|jd }|jjr|jj|jx>|jD]4\} } } } x$| D]} |jjtjj | | q WqW|jjrx||jjD]p}t|tr|t|}tjj |r|jj|n:|\}} x0| D](}t|}tjj |r|jj|qWqHW|jjr|jd }|jj|j|jjr|jd }|jj|j|jjr.|jd }|jj|jdS)NREADME README.txtFTz,standard file not found: should have one of z, zstandard file '%s' not foundz test/test*.pyz setup.cfgbuild_py build_ext build_clib build_scripts)r^r_)rRZ script_name isinstancetuplerTrUexistsrMrrjoinfilterrVrextendget_finalized_commandZhas_pure_modulesZget_source_filesZ data_filesZhas_data_filesstrr Zhas_ext_modulesZhas_c_librariesZ has_scripts)rZ standardsfnZaltsZgot_itZoptionalpatternfilesr`ZpkgZsrc_dirZ build_dir filenamesfilenameitemdirnamer/rarbrcrrrrZs\           "         zsdist.add_defaultscCstjd|jt|jddddddd}zlxf|j}|dkrr?)__name__ __module__ __qualname__Z descriptionrZ user_optionsZboolean_optionsrZ help_optionsZ negative_optZ sub_commandsrKrLrPrSrNrZr[r\r]rWrXrrOrrrrrr!sj  (P *r)rTr~typesrwarningsrZdistutils.corerZ distutilsrrrr Zdistutils.text_filer Zdistutils.errorsZdistutils.filelistr r Zdistutils.utilr rrrrrrs