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

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


�`^c@s�dZdZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZmZmZmZdd	lmZd
efd��YZdS(swdistutils.command.bdist_rpm

Implements the Distutils 'bdist_rpm' command (create RPM source and binary
distributions).s$Id$i�N(tCommand(tDEBUG(t
write_file(tget_python_version(tDistutilsOptionErrortDistutilsPlatformErrortDistutilsFileErrortDistutilsExecError(tlogt	bdist_rpmc+Bs�eZdZd^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�g)Zd2d7d;d0dSgZid2d56d7d96d;d=6ZdV�ZdW�ZdX�Z	dY�Z
dZ�Zd[�Zd\�Z
RS(�screate an RPM distributionsbdist-base=s/base directory for creating built distributionss	rpm-base=sdbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2)s	dist-dir=tdsDdirectory to put final RPM files in (and .spec files if --spec-only)spython=sMpath to Python interpreter to hard-code in the .spec file (default: "python")s
fix-pythonsLhard-code the exact path to the current Python interpreter in the .spec files	spec-onlysonly regenerate spec filessource-onlysonly generate source RPMsbinary-onlysonly generate binary RPMs	use-bzip2s7use bzip2 instead of gzip to create source distributionsdistribution-name=sgname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!)sgroup=s9package classification [default: "Development/Libraries"]srelease=sRPM release numbersserial=sRPM serial numbersvendor=saRPM "vendor" (eg. "Joe Blow <[email protected]>") [default: maintainer or author from setup script]s	packager=sARPM packager (eg. "Jane Doe <[email protected]>")[default: vendor]s
doc-files=s6list of documentation files (space or comma-separated)s
changelog=s
RPM changelogsicon=sname of icon files	provides=s%capabilities provided by this packages	requires=s%capabilities required by this packages
conflicts=s-capabilities which conflict with this packagesbuild-requires=s+capabilities required to build this packages
obsoletes=s*capabilities made obsolete by this packages
no-autoreqs+do not automatically calculate dependenciess	keep-temptks"don't clean up RPM build directorysno-keep-temps&clean up RPM build directory [default]suse-rpm-opt-flagss8compile with RPM_OPT_FLAGS when building from source RPMsno-rpm-opt-flagss&do not pass any RPM CFLAGS to compilers	rpm3-modes"RPM 3 compatibility mode (default)s	rpm2-modesRPM 2 compatibility modesprep-script=s3Specify a script for the PREP phase of RPM buildings
build-script=s4Specify a script for the BUILD phase of RPM buildingspre-install=s:Specify a script for the pre-INSTALL phase of RPM buildingsinstall-script=s6Specify a script for the INSTALL phase of RPM buildings
post-install=s;Specify a script for the post-INSTALL phase of RPM buildingspre-uninstall=s<Specify a script for the pre-UNINSTALL phase of RPM buildingspost-uninstall=s=Specify a script for the post-UNINSTALL phase of RPM buildings
clean-script=s4Specify a script for the CLEAN phase of RPM buildingsverify-script=s6Specify a script for the VERIFY phase of the RPM buildsforce-arch=s0Force an architecture onto the RPM build processtquiettqs3Run the INSTALL phase of RPM building in quiet modecCscd|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_!d|_"d|_#d|_$d|_%d|_&d|_'dS(Nii((tNonet
bdist_basetrpm_basetdist_dirtpythont
fix_pythont	spec_onlytbinary_onlytsource_onlyt	use_bzip2tdistribution_nametgrouptreleasetserialtvendortpackagert	doc_filest	changelogticontprep_scripttbuild_scripttinstall_scripttclean_scriptt
verify_scripttpre_installtpost_installt
pre_uninstalltpost_uninstalltpreptprovidestrequirest	conflictstbuild_requirest	obsoletest	keep_temptuse_rpm_opt_flagst	rpm3_modet
no_autoreqt
force_archR(tself((s1/sys/lib/python2.7/distutils/command/bdist_rpm.pytinitialize_options�sN																																						cCs|jdd�|jdkrR|js4td�ntjj|jd�|_n|j	dkr�|j
rytj|_	q�d|_	n|j
r�td�ntj
dkr�tdtj
�n|jr�|jr�td	�n|jj�s�|_n|jdd
�|j�dS(NtbdistRs)you must specify --rpm-base in RPM 2 modetrpmRs8--python and --fix-python are mutually exclusive optionstposixs9don't know how to create RPM distributions on platform %ss6cannot supply both '--source-only' and '--binary-only'iR(s
bdist_bases
bdist_base(sdist_dirsdist_dir(tset_undefined_optionsRRR2RtostpathtjoinRRRtsyst
executabletnameRRRtdistributionthas_ext_modulesR1tfinalize_package_data(R5((s1/sys/lib/python2.7/distutils/command/bdist_rpm.pytfinalize_options�s0					
	cCs�|jdd�|jdd|jj�|jj�f�|jd�|jd�t|jt�r�xEdD]:}tj	j
|�ro||jkro|jj|�qoqoWn|jd	d
�|jd�|jd�|jd
�|j|j
�|_
|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�dS(NRsDevelopment/LibrariesRs%s <%s>RRtREADMEs
README.txtRt1RRRR R!R"R#R$R%R&R'R(R)R+R,R-R.R/R4(REs
README.txt(t
ensure_stringRAtget_contacttget_contact_emailtensure_string_listt
isinstanceRtlistR;R<texiststappendt_format_changelogRtensure_filename(R5treadme((s1/sys/lib/python2.7/distutils/command/bdist_rpm.pyRC�s>	


!

















cCs�tr>dGHdG|jGHdG|jGHdG|jGHdG|jGHn|jr`|j}|j|�nNi}x;d'D]3}tj	j
|j|�||<|j||�qmW|d}tj	j
|d|jj
��}|jt||j�fd|�|jrdS|jj}|jd
�}|jr4dg|_ndg|_|jd
�||j_|j�d}|d}|j||�|jr�tj	j|j�r�|j|j|�q�td|j�ntjd�dg}	tj	jd�stj	jd�rdg}	n|jr)|	jd�n&|jrB|	jd�n
|	jd�|j r�|	j!ddtj	j"|j�g�n|j#s�|	jd�n|j$r�|	jd�n|	j|�d}
|
d}d |
d!}d"|||f}
tj%|
�}z�g}d}x[|j'�}|s(Pnt(j)t(j*|��}|j|d#�|dkr|d}qq|j+�}|r�t,d$t-|
���nWd|j+�X|j.|	�|j/s�jj0�r�t1�}nd%}|jsJtj	j
|d
|�}|j2||j�tj	j
|j|�}|jjjd&||f�n|js��|D]�}tj	j
|d	|�}tj	j|�rZ|j2||j�tj	j
|jtj	j3|��}|jjjd&||f�qZqZWq�dS((Nsbefore _get_package_data():svendor =s
packager =sdoc_files =schangelog =tSOURCEStSPECStBUILDtRPMStSRPMSs%s.specswriting '%s'tsdisttbztartgztarisicon file '%s' does not exists
building RPMsR8s/usr/bin/rpmbuilds
/bin/rpmbuildtrpmbuilds-bss-bbs-bas--defines
_topdir %ss--cleans--quiets%{name}-%{version}-%{release}s.src.rpms%{arch}/s.%{arch}.rpms%rpm -q --qf '%s %s\n' --specfile '%s'isFailed to execute: %stanyR	(RRRSRTRURV(4RRRRRRRtmkpathR;R<R=RRAtget_nametexecuteRt_make_spec_filet
dist_filestreinitialize_commandRtformatstrun_commandtget_archive_filest	copy_fileR RMRRtinfoRRNRR2textendtabspathR0RtpopenRtreadlinetstringtsplittstriptcloseRtreprtspawntdry_runRBRt	move_filetbasename(R5tspec_dirtrpm_dirR
t	spec_pathtsaved_dist_filesRWtsourcet
source_dirtrpm_cmdt
nvr_stringtsrc_rpmtnon_src_rpmtq_cmdtouttbinary_rpmst
source_rpmtlinetltstatust	pyversiontsrpmtfilenameR8((s1/sys/lib/python2.7/distutils/command/bdist_rpm.pytruns�		

		
	

	
			
		 		


			
cCs"tjj|jtjj|��S(N(R;R<R=RRs(R5R<((s1/sys/lib/python2.7/distutils/command/bdist_rpm.pyt
_dist_path�scCs�d|jj�d|jj�jdd�d|jj�d|jjdd�dd|jj�g}|jd	d
dg�|jr�|jd�n
|jd
�|jd|jj	�d|j
ddg�|js�jj�s|jd�qn|jd|j�x~dBD]v}t
|tj|��}t|t�rj|jd|tj|�f�q|dCk	r|jd||f�qqW|jj�dkr�|jd|jj��n|jr�jd|j�n|jr|jdtj|j��n|jr;|jdtjj|j��n|jrT|jd �n|jdd!|jj�g�d"|jtjjtjd#�f}d$|}|j r�d%|}nd&|}dDd*d+|fd,d-|fdEdFdGdHdIdJg	}x�|D]�\}}	}
t
||	�}|s'|
r�jdd;|g�|ro|jtj!t"|d<�j#�d=��q|j|
�q�W|jdd>d?g�|j$r�|jd@tj|j$��n|j%r�jddAg�|j|j%�n|S(KsiGenerate the text of an RPM spec file and return it as a
        list of strings (one per line).
        s
%define name s%define version t-t_s%define unmangled_version s%define release ts	Summary: s
Name: %{name}sVersion: %{version}sRelease: %{release}s-Source0: %{name}-%{unmangled_version}.tar.bz2s,Source0: %{name}-%{unmangled_version}.tar.gzs	License: sGroup: s>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootsPrefix: %{_prefix}sBuildArch: noarchs
BuildArch: %stVendortPackagertProvidestRequirest	Conflictst	Obsoletess%s: %stUNKNOWNsUrl: sDistribution: sBuildRequires: sIcon: s
AutoReq: 0s%descriptions%s %sis%s buildsenv CFLAGS="$RPM_OPT_FLAGS" s>%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILESR*R!s&%setup -n %{name}-%{unmangled_version}tbuildR"tinstallR#tcleanR$srm -rf $RPM_BUILD_ROOTtverifyscriptR%tpreR&tpostR'tpreunR(tpostunR)t%trs
s%files -f INSTALLED_FILESs%defattr(-,root,root)s%doc s
%changelog(R�R�R�R�R�R�N(sprepsprep_scripts&%setup -n %{name}-%{unmangled_version}(R�sclean_scriptsrm -rf $RPM_BUILD_ROOT(R�s
verify_scriptN(R�spre_installN(R�spost_installN(R�s
pre_uninstallN(R�spost_uninstallN(&RAR]tget_versiontreplaceRtget_descriptionRgRRNtget_licenseRR4RBtgetattrRktlowerRKRLR=Rtget_urlRR.R R;R<RsR3tget_long_descriptionRR>targvR1RltopentreadRR(R5t	spec_filetfieldtvaltdef_setup_callt	def_buildtinstall_cmdtscript_optionstrpm_opttattrtdefault((s1/sys/lib/python2.7/distutils/command/bdist_rpm.pyR_�s�

	


	
#				#	&
	
	+
	 	
cCs�|s
|Sg}x�tjtj|�d�D]l}tj|�}|ddkrg|jd|g�q,|ddkr�|j|�q,|jd|�q,W|ds�|d=n|S(sKFormat the changelog correctly and convert it to a list of strings
        s
it*R�R�s  (RkRlRmRgRN(R5Rt
new_changelogR�((s1/sys/lib/python2.7/distutils/command/bdist_rpm.pyRO5s"

N(sbdist-base=Ns/base directory for creating built distributions(s	rpm-base=Nsdbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2)(s	dist-dir=R
sDdirectory to put final RPM files in (and .spec files if --spec-only)(spython=NsMpath to Python interpreter to hard-code in the .spec file (default: "python")(s
fix-pythonNsLhard-code the exact path to the current Python interpreter in the .spec file(s	spec-onlyNsonly regenerate spec file(ssource-onlyNsonly generate source RPM(sbinary-onlyNsonly generate binary RPM(s	use-bzip2Ns7use bzip2 instead of gzip to create source distribution(sdistribution-name=Nsgname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!)(sgroup=Ns9package classification [default: "Development/Libraries"](srelease=NsRPM release number(sserial=NsRPM serial number(svendor=NsaRPM "vendor" (eg. "Joe Blow <[email protected]>") [default: maintainer or author from setup script](s	packager=NsARPM packager (eg. "Jane Doe <[email protected]>")[default: vendor](s
doc-files=Ns6list of documentation files (space or comma-separated)(s
changelog=Ns
RPM changelog(sicon=Nsname of icon file(s	provides=Ns%capabilities provided by this package(s	requires=Ns%capabilities required by this package(s
conflicts=Ns-capabilities which conflict with this package(sbuild-requires=Ns+capabilities required to build this package(s
obsoletes=Ns*capabilities made obsolete by this package(s
no-autoreqNs+do not automatically calculate dependencies(s	keep-tempRs"don't clean up RPM build directory(sno-keep-tempNs&clean up RPM build directory [default](suse-rpm-opt-flagsNs8compile with RPM_OPT_FLAGS when building from source RPM(sno-rpm-opt-flagsNs&do not pass any RPM CFLAGS to compiler(s	rpm3-modeNs"RPM 3 compatibility mode (default)(s	rpm2-modeNsRPM 2 compatibility mode(sprep-script=Ns3Specify a script for the PREP phase of RPM building(s
build-script=Ns4Specify a script for the BUILD phase of RPM building(spre-install=Ns:Specify a script for the pre-INSTALL phase of RPM building(sinstall-script=Ns6Specify a script for the INSTALL phase of RPM building(s
post-install=Ns;Specify a script for the post-INSTALL phase of RPM building(spre-uninstall=Ns<Specify a script for the pre-UNINSTALL phase of RPM building(spost-uninstall=Ns=Specify a script for the post-UNINSTALL phase of RPM building(s
clean-script=Ns4Specify a script for the CLEAN phase of RPM building(sverify-script=Ns6Specify a script for the VERIFY phase of the RPM build(sforce-arch=Ns0Force an architecture onto the RPM build process(squietR
s3Run the INSTALL phase of RPM building in quiet mode(t__name__t
__module__tdescriptionRtuser_optionstboolean_optionstnegative_optR6RDRCR�R�R_RO(((s1/sys/lib/python2.7/distutils/command/bdist_rpm.pyR	s�		

	0	"	/	�	�t__doc__t__revision__R>R;Rktdistutils.coreRtdistutils.debugRtdistutils.file_utilRtdistutils.sysconfigRtdistutils.errorsRRRRt	distutilsRR	(((s1/sys/lib/python2.7/distutils/command/bdist_rpm.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].