�
��c@s�dZdZddkZddkZddkZddkTddklZddklZddk l
Z
lZlZl
Z
ddklZddkTdd klZdd
k lZd�Zdefd
��YZdS(sadistutils.command.sdist
Implements the Distutils 'sdist' command (create a source distribution).s1$Id: sdist.py 38697 2005-03-23 18:54:36Z loewis $i�N(t*(tglob(tCommand(tdir_utiltdep_utilt file_utiltarchive_util(tTextFile(tFileList(tlogcCs�ddkl}ddkl}g}x6|i�D](}|id|d||df�q3W|i�||�}|id�dS(soPrint all possible values for the 'formats' option (used by
the "--help-formats" command-line option).
i�(tFancyGetopt(tARCHIVE_FORMATSsformats=is.List of available source distribution formats:N( tdistutils.fancy_getoptR
tdistutils.archive_utilRtkeystappendtNonetsortt
print_help(R
Rtformatstformattpretty_printer((s*/sys/lib/python/distutils/command/sdist.pytshow_formatss
tsdistc
BseZdZd1d2d4d5d6d7d8d9d:ddddfd;gZdddddgZdd3defgZhdd <dd
<Zhd d!<d"d#<Z d$�Z
d%�Zd&�Zd'�Z
d(�Zd)�Zd*�Zd+�Zd,�Zd-�Zd.�Zd/�Zd0�ZRS(<s6create a source distribution (tarball, zip file, etc.)s template=tts5name of manifest template file [default: MANIFEST.in]s manifest=tms)name of manifest file [default: MANIFEST]suse-defaultssRinclude the default file set in the manifest [default; disable with --no-defaults]sno-defaultss"don't include the default file settprunes�specifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune]sno-prunes$don't automatically exclude anythings
manifest-onlytosEjust regenerate the manifest and then stop (implies --force-manifest)sforce-manifesttfs6forcibly regenerate the manifest and carry on as usualsformats=s6formats for source distribution (comma-separated list)s keep-temptks1keep the distribution tree around after creating sarchive file(s)s dist-dir=tdsFdirectory to put the source distribution archive(s) in [default: dist]shelp-formatss#list available distribution formatstgztartposixtziptntcCs^d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_
dS(Nii(Rttemplatetmanifesttuse_defaultsRt
manifest_onlytforce_manifestRt keep_temptdist_dirt
archive_files(tself((s*/sys/lib/python/distutils/command/sdist.pytinitialize_optionsUs cCs�|idjo
d|_n|idjo
d|_n|id�|idjoHy|itig|_Wq�tj
ot ddti�q�Xnt
i|i�}|otd|�n|i
djo
d|_
ndS(NtMANIFESTsMANIFEST.inRs.don't know how to create source distributions son platform %ssunknown archive format '%s'tdist(R$RR#tensure_string_listRtdefault_formattostnametKeyErrortDistutilsPlatformErrorRtcheck_archive_formatstDistutilsOptionErrorR)(R+t
bad_format((s*/sys/lib/python/distutils/command/sdist.pytfinalize_optionsjs$
cCs@t�|_|i�|i�|iodSn|i�dS(N(Rtfilelisttcheck_metadatat
get_file_listR&tmake_distribution(R+((s*/sys/lib/python/distutils/command/sdist.pytrun�s
cCs�|ii}g}x?dD]7}t||�o
t||�p|i|�qqW|o!|idti|d��n|io#|i p|idd�q�nC|i
o#|ip|idd �q�n|id
dd�d
S(s�Ensure that all required elements of meta-data (name, version,
URL, (author and author_email) or (maintainer and
maintainer_email)) are supplied by the Distribution object; warn if
any are missing.
R2tversionturlsmissing required meta-data: s, s)missing meta-data: if 'author' supplied, s#'author_email' must be supplied toos-missing meta-data: if 'maintainer' supplied, s''maintainer_email' must be supplied toos4missing meta-data: either (author and author_email) s%or (maintainer and maintainer_email) smust be suppliedN(snamesversionsurl(tdistributiontmetadatathasattrtgetattrRtwarntstringtjointauthortauthor_emailt
maintainertmaintainer_email(R+RAtmissingtattr((s*/sys/lib/python/distutils/command/sdist.pyR:�s(
cCs~tii|i�}|oti|i|i�}n|id|ii |if�ti|ii |i�}|o|p|}|i
p|i}tii|i�}|o|}|p|p|o�|p|idd|i�n|i
i�|io|i�n|o|i�n|io|i�n|i
i�|i
i�|i�n|i�dS(scFigure 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 and the state of the filesystem.
schecking if %s newer than %ss&manifest template '%s' does not exist s(using default file list)N(R1tpathtisfileR#RtnewerR$tdebug_printR@tscript_nameR'R&RDR9tfindallR%tadd_defaultst
read_templateRtprune_file_listRtremove_duplicatestwrite_manifestt
read_manifest(R+ttemplate_existsttemplate_newertsetup_newertmanifest_outofdatetforce_regentmanifest_existstneither_exists((s*/sys/lib/python/distutils/command/sdist.pyR;�s8
cCs d|iig}x�|D]�}t|�tjow|}d}x<|D]4}tii|�od}|ii|�PqEqEW|p!|i dt
i|d��q�qtii|�o|ii|�q|i d|�qWdd g}xD|D]<}ttii
t|��}|o|ii|�q��ii�o)|id
�}|ii|i��n|ii�o)|id�} |ii| i��n|ii�o)|id�}
|ii|
i��n|ii�o)|id
�}|ii|i��ndS(s�Add all the default files to self.filelist:
- README or README.txt
- setup.py
- test/test*.py
- all pure Python modules mentioned in setup script
- 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.
tREADMEs
README.txtiis,standard file not found: should have one of s, sstandard file '%s' not founds
test/test*.pys setup.cfgtbuild_pyt build_extt
build_clibt
build_scriptsN(sREADMEs
README.txt(R@RQttypet TupleTypeR1RMtexistsR9RRDRERFtfilterRNRtextendthas_pure_modulestget_finalized_commandtget_source_filesthas_ext_modulesthas_c_librariesthas_scripts(R+t standardstfntaltstgot_ittoptionaltpatterntfilesRaRbRcRd((s*/sys/lib/python/distutils/command/sdist.pyRSsH cCs�tid|i�t|idddddddddddd�}xm|i�}|d
joPny|ii|�WqItj
o)}|i d |i
|i|f�qIXqId
S(s�Read 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.
sreading manifest template '%s'tstrip_commentsitskip_blankst
join_linest lstrip_wst rstrip_wst
collapse_joins%s, line %d: %sN(R tinfoR#RtreadlineRR9tprocess_template_linetDistutilsTemplateErrorRDtfilenametcurrent_line(R+R#tlinetmsg((s*/sys/lib/python/distutils/command/sdist.pyRT:s$
cCsg|id�}|ii�}|iidd|i�|iidd|�|iiddd�dS(s`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 and .svn directories
tbuildtprefixs/(RCS|CVS|\.svn)/.*tis_regexiN(RkR@tget_fullnameR9texclude_patternRt
build_base(R+R�tbase_dir((s*/sys/lib/python/distutils/command/sdist.pyRUXs
cCs0|iti|i|iifd|i�dS(s�Write the file list in 'self.filelist' (presumably as filled in
by 'add_defaults()' and 'read_template()') to the manifest file
named by 'self.manifest'.
swriting manifest file '%s'N(texecuteRt
write_fileR$R9Rv(R+((s*/sys/lib/python/distutils/command/sdist.pyRWhscCs|tid|i�t|i�}xS|i�}|djoPn|ddjo|dd!}n|ii|�q%dS(s�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.
sreading manifest file '%s'ti�s
iN(R R}R$topenR~R9R(R+R$R�((s*/sys/lib/python/distutils/command/sdist.pyRXts
cCs�|i|�ti||d|i�ttd�od}d|}nd}d|}|ptid�nti |�xa|D]Y}ti
i|�ptid|�q�ti
i||�}|i
||d|�q�W|iii|�dS( s�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.
tdry_runtlinkthardsmaking hard links in %s...scopying files to %s...s)no files to distribute -- empty manifest?s#'%s' not a regular file -- skippingN(tmkpathRtcreate_treeR�RBR1RR RDR}RMRNRFt copy_fileR@RAtwrite_pkg_info(R+R�RvR�R�tfiletdest((s*/sys/lib/python/distutils/command/sdist.pytmake_release_tree�s"
cCs�|ii�}tii|i|�}|i||ii�g}xR|i D]G}|i
||d|�}|i|�|iiidd|f�qMW||_
|ipti|d|i�ndS(s�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()'.
R�RR�R�N(R@R�R1RMRFR)R�R9RvRtmake_archiveRt
dist_filesR*R(Rtremove_treeR�(R+R�t base_nameR*tfmtR�((s*/sys/lib/python/distutils/command/sdist.pyR<�s
cCs|iS(szReturn the list of archive files created when the command
was run, or None if the command hasn't run yet.
(R*(R+((s*/sys/lib/python/distutils/command/sdist.pytget_archive_files�s(s template=Rs5name of manifest template file [default: MANIFEST.in](s manifest=Rs)name of manifest file [default: MANIFEST]N(suse-defaultsNsRinclude the default file set in the manifest [default; disable with --no-defaults](sno-defaultsNs"don't include the default file set(spruneNs�specifically exclude files/directories that should not be distributed (build tree, RCS/CVS dirs, etc.) [default; disable with --no-prune](sno-pruneNs$don't automatically exclude anything(s
manifest-onlyRsEjust regenerate the manifest and then stop (implies --force-manifest)(sforce-manifestRs6forcibly regenerate the manifest and carry on as usual(sformats=Ns6formats for source distribution (comma-separated list)(s dist-dir=RsFdirectory to put the source distribution archive(s) in [default: dist](t__name__t
__module__tdescriptionRtuser_optionstboolean_optionsRthelp_optionstnegative_optR0R,R8R=R:R;RSRTRURWRXR�R<R�(((s*/sys/lib/python/distutils/command/sdist.pyR#s\
! F 9 , (t__doc__t__revision__tsysR1REttypesRtdistutils.coreRt distutilsRRRRtdistutils.text_fileRtdistutils.errorstdistutils.filelistRR RR(((s*/sys/lib/python/distutils/command/sdist.pys<module>s$
"
|