U âQabÜã@s„ddlmZddlmmZddlZddlZddlZddl Z ddl m Z ddl m Z ddlZeZd dd„ZGd d „d e ejƒZdS) é)ÚlogN)Úsixé)Úsdist_add_defaultsÚccs,t d¡D]}| ¡|ƒD] }|Vqq dS)z%Find all files under revision controlzsetuptools.file_findersN)Ú pkg_resourcesZiter_entry_pointsÚload)ÚdirnameZepÚitem©r ú)szsdist.cCs–| d¡| d¡}|j|_|j tj |jd¡¡| ¡|  ¡D]}| |¡qD|  ¡t |j dgƒ}|j D] }dd|f}||krp| |¡qpdS)NÚegg_infoz SOURCES.txtÚ dist_filesrr)Z run_commandÚget_finalized_commandÚfilelistÚappendÚosÚpathÚjoinrÚ check_readmeZget_sub_commandsÚmake_distributionÚgetattrÚ distributionZ archive_files)ÚselfZei_cmdZcmd_namerÚfileÚdatar r r Úrun+s      z sdist.runcCstj |¡| ¡dS)N)ÚorigrÚinitialize_optionsÚ_default_to_gztar©r r r r r%>s zsdist.initialize_optionscCstjdkrdSdg|_dS)N)éérZbetarZgztar)ÚsysÚ version_infoZformatsr'r r r r&Cs zsdist._default_to_gztarc Cs$| ¡tj |¡W5QRXdS)z% Workaround for #516 N)Ú_remove_os_linkr$rrr'r r r rIs zsdist.make_distributionc cs^Gdd„dƒ}ttd|ƒ}zt`Wntk r6YnXz dVW5||k rXttd|ƒXdS)zG In a context, remove and restore os.link if it exists c@s eZdZdS)z&sdist._remove_os_link..NoValueN)Ú__name__Ú __module__Ú __qualname__r r r r ÚNoValueWsr0ÚlinkN)rrr1Ú ExceptionÚsetattr)r0Zorig_valr r r r,Ps  zsdist._remove_os_linkcCsLztj |¡Wn6tk rFt ¡\}}}|jjjd  ¡‚YnXdS)NÚtemplate) r$rÚ read_templater2r*Úexc_infoÚtb_nextÚtb_frameÚf_localsÚclose)r Ú_Útbr r r Z__read_template_hackes zsdist.__read_template_hack)éér=)r(r)r(ré)r(r=)r(r=rcs^|j ¡rZ| d¡}|j | ¡¡|jjsZ|jD]&\}‰}}|j ‡fdd„|Dƒ¡q2dS)zgetting python filesÚbuild_pycsg|]}tj ˆ|¡‘qSr )rrr)rÚfilename©Zsrc_dirr r Ú ‡sÿz.sdist._add_defaults_python..N)rZhas_pure_modulesrrÚextendZget_source_filesZinclude_package_dataZ data_files)r r@r;Ú filenamesr rBr Ú_add_defaults_python|s  ÿzsdist._add_defaults_pythoncsDz tjrt |¡n tƒ ¡Wntk r>t d¡YnXdS)Nz&data_files contains unexpected objects)rZPY2rÚ_add_defaults_data_filesÚsuperÚ TypeErrorrÚwarnr'©Ú __class__r r rGŠs  zsdist._add_defaults_data_filescCs8|jD]}tj |¡rdSq| dd |j¡¡dS)Nz,standard file not found: should have one of z, )ÚREADMESrrÚexistsrJr)r Úfr r r r“s   ÿÿzsdist.check_readmecCs^tj |||¡tj |d¡}ttdƒrJtj |¡rJt |¡|  d|¡|  d¡  |¡dS)Nz setup.cfgr1r) r$rÚmake_release_treerrrÚhasattrrNÚunlinkZ copy_filerZsave_version_info)r Zbase_dirÚfilesÚdestr r r rPs   zsdist.make_release_treec Cs@tj |j¡sdSt |jd¡}| ¡}W5QRX|d ¡kS)NFÚrbz+# file GENERATED by distutils, do NOT edit )rrÚisfileÚmanifestÚioÚopenÚreadlineÚencode)r ÚfpZ first_liner r r Ú_manifest_is_not_generatedªsÿz sdist._manifest_is_not_generatedc Cst d|j¡t|jdƒ}|D]d}tjr^z| d¡}Wn&tk r\t d|¡YqYnX|  ¡}|  d¡s|svq|j   |¡q|  ¡dS)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'rUzUTF-8z"%r not UTF-8 decodable -- skippingú#N)rÚinforWrYrZPY3ÚdecodeÚUnicodeDecodeErrorrJÚstripÚ startswithrrr:)r rWÚliner r r Ú read_manifest´s  zsdist.read_manifestcCs^|j d¡}| dd¡\}}|dkr2t d¡dStj |¡sNt d|¡dS|j   |¡dS)zyChecks if license_file' is configured and adds it to 'self.filelist' if the value contains a valid path. ZmetadataÚ license_file)NNNz''license_file' option was not specifiedz8warning: Failed to find the configured license file '%s') rZget_option_dictÚgetrÚdebugrrrNrJrr)r Zoptsr;rfr r r Ú check_licenseÊs   ÿzsdist.check_license)r-r.r/Ú__doc__Z user_optionsZ negative_optZREADME_EXTENSIONSÚtuplerMr#r%r&rÚ staticmethodÚ contextlibÚcontextmanagerr,Z_sdist__read_template_hackr*r+Zhas_leaky_handler5rFrGrrPr]reriÚ __classcell__r r rKr rs<ú    ÿý    r)r)Z distutilsrZdistutils.command.sdistZcommandrr$rr*rXrmZsetuptools.externrZ py36compatrrÚlistZ_default_revctrlr r r r r Ús