Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/distutils/command/sdist.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@sdZdZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
mZddlmZdd	lmZmZmZdd
lmZddl
mZddlmZd
�Zde	fd��YZdS(sadistutils.command.sdist

Implements the Distutils 'sdist' command (create a source distribution).s$Id$i�N(tglob(twarn(tCommand(tdir_utiltdep_utilt	file_utiltarchive_util(tTextFile(tDistutilsPlatformErrortDistutilsOptionErrortDistutilsTemplateError(tFileList(tlog(tconvert_pathcCs�ddlm}ddlm}g}x6|j�D](}|jd|d||df�q3W|j�||�jd�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_getoptRtdistutils.archive_utilRtkeystappendtNonetsortt
print_help(RRtformatstformat((s-/sys/lib/python2.7/distutils/command/sdist.pytshow_formatss
tsdistcBs6eZdZd�Zd<d=d?d@dAdBdCdDdEddddfdFdGdHdIgZddddddgZd'd>d(efgZidd
6dd6Z	id)d*6d+d,6Z
d-efgZd.�Zd/�Z
d0�Zd1�Zd2�Zd3�Zd4�Zd5�Zd6�Zd7�Zd8�Zd9�Zd:�Zd;�ZRS(Js6create a source distribution (tarball, zip file, etc.)cCs|jS(sYCallable used for the check sub-command.

        Placed here so user_options can view it(tmetadata_check(tself((s-/sys/lib/python2.7/distutils/command/sdist.pytchecking_metadata(ss	template=tts5name of manifest template file [default: MANIFEST.in]s	manifest=tms)name of manifest file [default: MANIFEST]suse-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-manifesttfskforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.sformats=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]smetadata-checks[Ensure that all required elements of meta-data are supplied. Warn if any missing. [default]sowner=tus@Owner name used when creating a tar file [default: current user]sgroup=tgsAGroup name used when creating a tar file [default: current group]shelp-formatss#list available distribution formatstgztartposixtziptnttcheckcCsyd|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
dS(Nii(Rttemplatetmanifesttuse_defaultsR t
manifest_onlytforce_manifestRt	keep_temptdist_dirt
archive_filesRtownertgroup(R((s-/sys/lib/python2.7/distutils/command/sdist.pytinitialize_optionsfs												cCs�|jdkrd|_n|jdkr6d|_n|jd�|jdkr�y|jtjg|_Wq�tk
r�t	ddtj�q�Xnt
j|j�}|r�td|�n|j
dkr�d|_
ndS(NtMANIFESTsMANIFEST.inRs.don't know how to create source distributions son platform %ssunknown archive format '%s'tdist(R-RR,tensure_string_listRtdefault_formattostnametKeyErrorRRtcheck_archive_formatsR	R2(Rt
bad_format((s-/sys/lib/python2.7/distutils/command/sdist.pytfinalize_options}s$


cCsUt�|_x!|j�D]}|j|�qW|j�|jrGdS|j�dS(N(Rtfilelisttget_sub_commandstrun_commandt
get_file_listR/tmake_distribution(Rtcmd_name((s-/sys/lib/python2.7/distutils/command/sdist.pytrun�s
	cCs7tdt�|jjd�}|j�|j�dS(sDeprecated API.sadistutils.command.sdist.check_metadata is deprecated,               use the check command insteadR+N(RtPendingDeprecationWarningtdistributiontget_command_objtensure_finalizedRG(RR+((s-/sys/lib/python2.7/distutils/command/sdist.pytcheck_metadata�s


cCs�tjj|j�}|rP|j�rP|j�|jj�|jj�dS|sq|j	dd|j�n|jj
�|jr�|j�n|r�|j
�n|jr�|j�n|jj�|jj�|j�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.
        Ns&manifest template '%s' does not exist s(using default file list)(R;tpathtisfileR,t_manifest_is_not_generatedt
read_manifestRARtremove_duplicatesRtfindallR.tadd_defaultst
read_templateR tprune_file_listtwrite_manifest(Rttemplate_exists((s-/sys/lib/python2.7/distutils/command/sdist.pyRD�s(


	
	

	


cCsd|jjg}x�|D]�}t|t�r�|}d}x:|D]2}tjj|�rAd}|jj|�PqAqAW|s�|j	dt
j|d��q�qtjj|�r�|jj|�q|j	d|�qWdd	g}xB|D]:}ttjj
t|��}|r�jj|�q��|jd
�}|jj�rb|jj|j��nxM|jD]B\}	}
}}x-|D]%}
|jjtjj|
|
��q�WqlW|jj�rlx�|jjD]�}t|t�rt|�}tjj
|�re|jj|�qeq�|\}}x?|D]7}t|�}tjj
|�r*|jj|�q*q*Wq�Wn|jj�r�|jd�}|jj|j��n|jj�r�|jd�}|jj|j��n|jj�r|jd
�}|jj|j��ndS(s9Add 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 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.
        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(RXs
README.txt(RItscript_namet
isinstancettupleR;RMtexistsRARRtstringtjointfilterRNRtextendtget_finalized_commandthas_pure_modulestget_source_filest
data_filesthas_data_fileststrR
thas_ext_modulesthas_c_librariesthas_scripts(Rt	standardstfntaltstgot_ittoptionaltpatterntfilesRYtpkgtsrc_dirt	build_dirt	filenamestfilenametitemtdirnameR"RZR[R\((s-/sys/lib/python2.7/distutils/command/sdist.pyRS�s^

	

'
cCs�tjd|j�t|jdddddddddddd�}zvxo|j�}|d
krhPny|jj|�WqLtt	fk
r�}|j
d	|j|j|f�qLXqLWd
|j
�Xd
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,RtreadlineRRAtprocess_template_lineR
t
ValueErrorRRytcurrent_linetclose(RR,tlinetmsg((s-/sys/lib/python2.7/distutils/command/sdist.pyRT,s(	cCs�|jd�}|jj�}|jjdd|j�|jjdd|�tjdkred}nd}dddd	d
ddg}d
|dj	|�|f}|jj|dd�dS(svPrune 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
        tbuildtprefixtwin32s/|\\t/tRCStCVSs\.svns\.hgs\.gits\.bzrt_darcss(^|%s)(%s)(%s).*t|tis_regexiN(
ReRItget_fullnameRAtexclude_patternRt
build_basetsystplatformRb(RR�tbase_dirtsepstvcs_dirstvcs_ptrn((s-/sys/lib/python2.7/distutils/command/sdist.pyRUMs		cCsk|j�r$tjd|j�dS|jj}|jdd�|jtj	|j|fd|j�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'.
        s5not writing to manually maintained manifest file '%s'Nis*# file GENERATED by distutils, do NOT editswriting manifest file '%s'(
RORR�R-RARttinserttexecuteRt
write_file(Rtcontent((s-/sys/lib/python2.7/distutils/command/sdist.pyRVgs	
cCsStjj|j�stSt|jd�}z|j�}Wd|j�X|dkS(NtrUs+# file GENERATED by distutils, do NOT edit
(R;RMRNR-tFalsetopenR�R�(Rtfpt
first_line((s-/sys/lib/python2.7/distutils/command/sdist.pyROvscCsytjd|j�t|j�}xF|D]>}|j�}|jd�s)|rWq)n|jj|�q)W|j�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't#N(	RR�R-R�tstript
startswithRARR�(RR-R�((s-/sys/lib/python2.7/distutils/command/sdist.pyRP�s
cCs�|j|�tj||d|j�ttd�rHd}d|}nd}d|}|sntjd�n
tj	|�x_|D]W}tj
j|�s�tjd|�q�tj
j||�}|j
||d|�q�W|jjj|�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�thasattrR;RRRR�RMRNRbt	copy_fileRItmetadatatwrite_pkg_info(RR�RtR�R�tfiletdest((s-/sys/lib/python2.7/distutils/command/sdist.pytmake_release_tree�s 
	



c
Cs|jj�}tjj|j|�}|j||jj�g}d|j	kr}|j	j
|j	j|j	jd���nxd|j	D]Y}|j
||d|d|jd|j�}|j
|�|jjj
dd|f�q�W||_|jstj|d|j�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()'.
        ttarR�R4R5RtR�N(RIR�R;RMRbR2R�RARtRRtpoptindextmake_archiveR4R5t
dist_filesR3R1Rtremove_treeR�(RR�t	base_nameR3tfmtR�((s-/sys/lib/python2.7/distutils/command/sdist.pyRE�s
+
 		cCs|jS(szReturn the list of archive files created when the command
        was run, or None if the command hasn't run yet.
        (R3(R((s-/sys/lib/python2.7/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(suse-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-onlyR!sEjust regenerate the manifest and then stop (implies --force-manifest)(sforce-manifestR"skforcibly regenerate the manifest and carry on as usual. Deprecated: now the manifest is always regenerated.(sformats=Ns6formats for source distribution (comma-separated list)(s	dist-dir=R$sFdirectory to put the source distribution archive(s) in [default: dist](smetadata-checkNs[Ensure that all required elements of meta-data are supplied. Warn if any missing. [default](sowner=R%s@Owner name used when creating a tar file [default: current user](sgroup=R&sAGroup name used when creating a tar file [default: current group](t__name__t
__module__tdescriptionRRtuser_optionstboolean_optionsRthelp_optionstnegative_optR:tsub_commandsR6R@RGRLRDRSRTRURVRORPR�RER�(((s-/sys/lib/python2.7/distutils/command/sdist.pyR$sn		



					(	R	!					*	(t__doc__t__revision__R;RaR�RtwarningsRtdistutils.coreRt	distutilsRRRRtdistutils.text_fileRtdistutils.errorsRR	R
tdistutils.filelistRRtdistutils.utilR
RR(((s-/sys/lib/python2.7/distutils/command/sdist.pyt<module>s"	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].