3

Q'íc7ã@s~ddlmZddljjZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlZeZddd„ZGd	d
„d
e
ejƒZdS)é)ÚlogN)Úsixé)Úsdist_add_defaultsÚccs4x.tjdƒD] }x|jƒ|ƒD]
}|VqWqWdS)z%Find all files under revision controlzsetuptools.file_findersN)Ú
pkg_resourcesÚiter_entry_pointsÚload)ÚdirnameÚepÚitem©r
ú>/tmp/pip-build-l_bcah40/setuptools/setuptools/command/sdist.pyÚwalk_revctrlsrcsôeZdZdZd0d2d3gZiZdd
ddgZedd„eDƒƒZdd„Z	dd„Z
dd„Zdd„Ze
ejdd„ƒƒZdd„Zejd4kp®d5ejkod6knp®d7ejkoªd8knZer¸eZd$d%„Z‡fd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Z‡ZS)9Úsdistz=Smart sdist that finds anything supported by revision controlúformats=Nú6formats for source distribution (comma-separated list)ú	keep-tempÚkz1keep the distribution tree around after creating zarchive file(s)ú	dist-dir=ÚdúFdirectory to put the source distribution archive(s) in [default: dist]rz.rstz.txtz.mdccs|]}dj|ƒVqdS)z	README{0}N)Úformat)Ú.0Úextr
r
rú	<genexpr>)szsdist.<genexpr>cCsž|jdƒ|jdƒ}|j|_|jjtjj|jdƒƒ|jƒx|j	ƒD]}|j|ƒqFW|j
ƒt|jdgƒ}x*|j
D] }dd|f}||krv|j|ƒqvWdS)NÚegg_infozSOURCES.txtÚ
dist_filesrr)Úrun_commandÚget_finalized_commandÚfilelistÚappendÚosÚpathÚjoinrÚcheck_readmeÚget_sub_commandsÚmake_distributionÚgetattrÚdistributionZ
archive_files)ÚselfZei_cmdÚcmd_namerÚfileÚdatar
r
rÚrun+s


z	sdist.runcCstjj|ƒ|jƒdS)N)ÚorigrÚinitialize_optionsÚ_default_to_gztar)r*r
r
rr0>szsdist.initialize_optionscCstjdkrdSdg|_dS)NéérÚbetarÚgztar)r2r3rr4r)ÚsysÚversion_infoÚformats)r*r
r
rr1Cs
zsdist._default_to_gztarc	Cs$|jƒtjj|ƒWdQRXdS)z%
        Workaround for #516
        N)Ú_remove_os_linkr/rr')r*r
r
rr'Is
zsdist.make_distributionccs^Gdd„dƒ}ttd|ƒ}yt`Wntk
r6YnXz
dVWd||k	rXttd|ƒXdS)zG
        In a context, remove and restore os.link if it exists
        c@seZdZdS)z&sdist._remove_os_link.<locals>.NoValueN)Ú__name__Ú
__module__Ú__qualname__r
r
r
rÚNoValueWsr=ÚlinkN)r(r"r>Ú	ExceptionÚsetattr)r=Zorig_valr
r
rr9Ps
zsdist._remove_os_linkcCsLytjj|ƒWn6tk
rFtjƒ\}}}|jjjdj	ƒ‚YnXdS)NÚtemplate)
r/rÚ
read_templater?r6Úexc_infoÚtb_nextÚtb_frameÚf_localsÚclose)r*Ú_Útbr
r
rZ__read_template_hackeszsdist.__read_template_hackéér2rrécsb|jjƒr^|jdƒ}|jj|jƒƒ|jjs^x0|jD]&\}‰}}|jj‡fdd„|Dƒƒq4WdS)zgetting python filesÚbuild_pycsg|]}tjjˆ|ƒ‘qSr
)r"r#r$)rÚfilename)Úsrc_dirr
rú
<listcomp>‡sz.sdist._add_defaults_python.<locals>.<listcomp>N)r)Úhas_pure_modulesrr ÚextendZget_source_filesZinclude_package_dataÚ
data_files)r*rMrHÚ	filenamesr
)rOrÚ_add_defaults_python|s

zsdist._add_defaults_pythoncsDy tjrtj|ƒn
tƒjƒWntk
r>tjdƒYnXdS)Nz&data_files contains unexpected objects)rÚPY2rÚ_add_defaults_data_filesÚsuperÚ	TypeErrorrÚwarn)r*)Ú	__class__r
rrWŠszsdist._add_defaults_data_filescCs:x4|jD]}tjj|ƒrdSqW|jddj|jƒƒdS)Nz,standard file not found: should have one of z, )ÚREADMESr"r#ÚexistsrZr$)r*Úfr
r
rr%“szsdist.check_readmecCs^tjj|||ƒtjj|dƒ}ttdƒrJtjj|ƒrJtj|ƒ|j	d|ƒ|j
dƒj|ƒdS)Nz	setup.cfgr>r)r/rÚmake_release_treer"r#r$Úhasattrr]ÚunlinkÚ	copy_filerZsave_version_info)r*Úbase_dirÚfilesÚdestr
r
rr_s
zsdist.make_release_treec	Cs@tjj|jƒsdStj|jdƒ}|jƒ}WdQRX|djƒkS)NFÚrbz+# file GENERATED by distutils, do NOT edit
)r"r#ÚisfileÚmanifestÚioÚopenÚreadlineÚencode)r*ÚfpÚ
first_liner
r
rÚ_manifest_is_not_generatedªsz sdist._manifest_is_not_generatedcCs”tjd|jƒt|jdƒ}xl|D]d}tjr^y|jdƒ}Wn$tk
r\tjd|ƒw YnX|j	ƒ}|j
dƒs |rxq |jj|ƒq W|j
ƒ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'rfzUTF-8z"%r not UTF-8 decodable -- skippingú#N)rÚinforhrjrÚPY3ÚdecodeÚUnicodeDecodeErrorrZÚstripÚ
startswithr r!rG)r*rhÚliner
r
rÚ
read_manifest´s
zsdist.read_manifest)rNrú@keep the distribution tree around after creating archive file(s))rrry)rrr)rJrKrJ)r2r)r2rrL)r2rJ)r2rJr)r:r;r<Ú__doc__Úuser_optionsÚnegative_optZREADME_EXTENSIONSÚtupler\r.r0r1r'ÚstaticmethodÚ
contextlibÚcontextmanagerr9Z_sdist__read_template_hackr6r7Zhas_leaky_handlerBrUrWr%r_rorxÚ
__classcell__r
r
)r[rrs:
	


r)r)Ú	distutilsrZdistutils.command.sdistÚcommandrr/r"r6rirZsetuptools.externrZ
py36compatrrÚlistZ_default_revctrlrr
r
r
rÚ<module>s