• File: bdist_rpm.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/distutils/command/__pycache__/bdist_rpm.cpython-37.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 12.2 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

MjT@sdZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlTddl
mZdd	lmZGd
ddeZdS)zwdistutils.command.bdist_rpm

Implements the Distutils 'bdist_rpm' command (create RPM source and binary
distributions).N)Command)DEBUG)get_platform)
write_file)*)get_python_version)logc)@seZdZdZdddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*g)Zd+d,d-d.d/gZd+d,d-d0Zd1d2Zd3d4Zd5d6Z	d7d8Z
d9d:Zd;d<Zd=d>Z
d?S)@	bdist_rpmzcreate an RPM distribution)zbdist-base=Nz/base directory for creating built distributions)z	rpm-base=Nzdbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2))z	dist-dir=dzDdirectory to put final RPM files in (and .spec files if --spec-only))zpython=NzMpath to Python interpreter to hard-code in the .spec file (default: "python"))z
fix-pythonNzLhard-code the exact path to the current Python interpreter in the .spec file)z	spec-onlyNzonly regenerate spec file)zsource-onlyNzonly generate source RPM)zbinary-onlyNzonly generate binary RPM)z	use-bzip2Nz7use bzip2 instead of gzip to create source distribution)zdistribution-name=Nzgname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!))zgroup=Nz9package classification [default: "Development/Libraries"])zrelease=NzRPM release number)zserial=NzRPM serial number)zvendor=NzaRPM "vendor" (eg. "Joe Blow <joe@example.com>") [default: maintainer or author from setup script])z	packager=NzBRPM packager (eg. "Jane Doe <jane@example.net>") [default: vendor])z
doc-files=Nz6list of documentation files (space or comma-separated))z
changelog=Nz
RPM changelog)zicon=Nzname of icon file)z	provides=Nz%capabilities provided by this package)z	requires=Nz%capabilities required by this package)z
conflicts=Nz-capabilities which conflict with this package)zbuild-requires=Nz+capabilities required to build this package)z
obsoletes=Nz*capabilities made obsolete by this package)z
no-autoreqNz+do not automatically calculate dependencies)z	keep-tempkz"don't clean up RPM build directory)zno-keep-tempNz&clean up RPM build directory [default])zuse-rpm-opt-flagsNz8compile with RPM_OPT_FLAGS when building from source RPM)zno-rpm-opt-flagsNz&do not pass any RPM CFLAGS to compiler)z	rpm3-modeNz"RPM 3 compatibility mode (default))z	rpm2-modeNzRPM 2 compatibility mode)zprep-script=Nz3Specify a script for the PREP phase of RPM building)z
build-script=Nz4Specify a script for the BUILD phase of RPM building)zpre-install=Nz:Specify a script for the pre-INSTALL phase of RPM building)zinstall-script=Nz6Specify a script for the INSTALL phase of RPM building)z
post-install=Nz;Specify a script for the post-INSTALL phase of RPM building)zpre-uninstall=Nz<Specify a script for the pre-UNINSTALL phase of RPM building)zpost-uninstall=Nz=Specify a script for the post-UNINSTALL phase of RPM building)z
clean-script=Nz4Specify a script for the CLEAN phase of RPM building)zverify-script=Nz6Specify a script for the VERIFY phase of the RPM build)zforce-arch=Nz0Force an architecture onto the RPM build process)quietqz3Run the INSTALL phase of RPM building in quiet modez	keep-tempzuse-rpm-opt-flagsz	rpm3-modez
no-autoreqr)zno-keep-tempzno-rpm-opt-flagsz	rpm2-modecCsd|_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)Nr)'
bdist_baserpm_basedist_dirpython
fix_python	spec_onlybinary_onlysource_only	use_bzip2distribution_namegroupreleaseserialvendorpackager	doc_files	changelogiconprep_scriptbuild_scriptinstall_scriptclean_script
verify_scriptpre_installpost_install
pre_uninstallpost_uninstallprepprovidesrequires	conflictsbuild_requires	obsoletes	keep_tempuse_rpm_opt_flags	rpm3_mode
no_autoreq
force_archr)selfr6@/opt/alt/python37/lib64/python3.7/distutils/command/bdist_rpm.pyinitialize_optionssNzbdist_rpm.initialize_optionscCs|dd|jdkr6|js$tdtj|jd|_|jdkrX|j	rPt
j|_qfd|_n|j	rftdtjdkr~t
dtj|jr|jrtd	|jsd
|_|dd|dS)NZbdist)rrz)you must specify --rpm-base in RPM 2 moderpmZpython3z8--python and --fix-python are mutually exclusive optionsposixz9don't know how to create RPM distributions on platform %sz6cannot supply both '--source-only' and '--binary-only'r)rr)Zset_undefined_optionsrr2ZDistutilsOptionErrorospathjoinrrrsys
executablenameZDistutilsPlatformErrorrrdistributionhas_ext_modulesr1finalize_package_data)r5r6r6r7finalize_optionss.





zbdist_rpm.finalize_optionscCsX|dd|dd|j|jf|d|dt|jtr|x.dD]&}tj	
|rR||jkrR|j|qRW|dd	|d
|d|d||j
|_
|d
|d|d|d|d|d|d|d|d|d|d|d|d|d|d|ddS)NrzDevelopment/Librariesrz%s <%s>rr)ZREADMEz
README.txtr1rrrr r!r"r#r$r%r&r'r(r)r+r,r-r.r/r4)Z
ensure_stringrAZget_contactZget_contact_emailZensure_string_list
isinstancerlistr;r<existsappend_format_changelogrZensure_filename)r5Zreadmer6r6r7rCs>





















zbdist_rpm.finalize_package_datacCstr<tdtd|jtd|jtd|jtd|j|jrT|j}||n<i}x.dD]&}t	j
|j|||<|||q^W|d}t	j
|d|j
}|t||fd	||jrdS|j
jdd}|d
}|jrdg|_ndg|_|d
||j
_|d
}|d}||||jrft	j
|jrX||j|ntd|jtddg}	t	j
dst	j
drdg}	|jr|	dn|j r|	dn
|	d|	!dd|j"g|j#r|	!ddt	j
$|jg|j%s|	d|j&r&|	d|	|d}
|
d}d|
d }d!|||f}
t	'|
}zg}d}xT|(}|s|P|)*}t+|d"kst,||d#|dkrl|d
}qlW|-}|rt.d$t/|
Wd|-X|0|	|j1s|j
2rt3}nd%}|j stt	j
|d&|}t	j
|sBt,|4||jt	j
|j|}|j
jd'||f|jsxh|D]`}t	j
|d(|}t	j
|r|4||jt	j
|jt	j
5|}|j
jd'||fqWdS))Nzbefore _get_package_data():zvendor =z
packager =zdoc_files =zchangelog =)SOURCESSPECSZBUILDRPMSSRPMSrLz%s.speczwriting '%s'sdistZbztarZgztarrrKzicon file '%s' does not existz
building RPMsr9z/usr/bin/rpmbuildz
/bin/rpmbuildZrpmbuildz-bsz-bbz-baz--definez__python %sz
_topdir %sz--cleanz--quietz%{name}-%{version}-%{release}z.src.rpmz%{arch}/z.%{arch}.rpmz%rpm -q --qf '%s %s\n' --specfile '%s'rzFailed to execute: %sanyrNr	rM)6rprintrrrrrrZmkpathr;r<r=rrAget_nameZexecuter_make_spec_fileZ
dist_filesZreinitialize_commandrZformatsZrun_commandZget_archive_filesZ	copy_filer rHZDistutilsFileErrorrinforrIrextendrr2abspathr0rpopenreadlinestripsplitlenAssertionErrorcloseZDistutilsExecErrorreprZspawnZdry_runrBrZ	move_filebasename)r5Zspec_dirZrpm_dirr
Z	spec_pathZsaved_dist_filesrOsourceZ
source_dirZrpm_cmdZ
nvr_stringZsrc_rpmZnon_src_rpmZq_cmdoutZbinary_rpmsZ
source_rpmlinelZstatusZ	pyversionZsrpmfilenamer9r6r6r7runs















z
bdist_rpm.runcCstj|jtj|S)N)r;r<r=rr`)r5r<r6r6r7
_dist_pathszbdist_rpm._dist_pathc	CsDd|jd|jddd|jd|jdddd|jg}td	}d
dd|	D}d
}d}|||}||kr|
d|
d|d
|dddg|jr|
dn
|
d|d|j
d|jddg|js|js&|
dn|
d|jx^dD]V}t||}t|trd|
d|d|fn|dk	r,|
d||fq,W|jd kr|
d!|j|jr|
d"|j|jr|
d#d|j|jr|
d$tj|j|jr|
d%|dd&|jgd'|jtjtj d(f}d)|}	|j!r\d*|	}	d+|}
d,d-d.|	fd/d0|
fd1d2d3d4d5d6g	}xh|D]`\}}
}t||
}|s|r|dd7|g|r|t"|d8#$d
n
|
|qW|dd9d:g|j%r|
d;d|j%|j&r@|dd<g||j&|S)=ziGenerate the text of an RPM spec file and return it as a
        list of strings (one per line).
        z
%define name z%define version -_z%define unmangled_version z%define release z	Summary: zrpm --eval %{__os_install_post}
cSsg|]}d|qS)z  %s \)rZ).0rcr6r6r7
<listcomp>sz-bdist_rpm._make_spec_file.<locals>.<listcomp>zbrp-python-bytecompile \
z%brp-python-bytecompile %{__python} \
z2# Workaround for http://bugs.python.org/issue14443z%define __os_install_post z
Name: %{name}zVersion: %{version}zRelease: %{release}z-Source0: %{name}-%{unmangled_version}.tar.bz2z,Source0: %{name}-%{unmangled_version}.tar.gzz	License: zGroup: z>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootzPrefix: %{_prefix}zBuildArch: noarchz
BuildArch: %s)ZVendorZPackagerZProvidesZRequiresZ	ConflictsZ	Obsoletesz%s: %s NZUNKNOWNzUrl: zDistribution: zBuildRequires: zIcon: z
AutoReq: 0z%descriptionz%s %srz%s buildzenv CFLAGS="$RPM_OPT_FLAGS" z>%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES)r*r!z&%setup -n %{name}-%{unmangled_version}Zbuildr"Zinstallr#)Zcleanr$zrm -rf $RPM_BUILD_ROOT)Zverifyscriptr%N)Zprer&N)Zpostr'N)Zpreunr(N)Zpostunr)N%rz%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z
%changelog)'rArSZget_versionreplacerZget_description
subprocessZ	getoutputr=
splitlinesrIrVrZget_licenserr4rBgetattrlowerrFrGZget_urlrr.r r;r<r`r3Zget_long_descriptionrr>argvr1openreadr[rr)r5Z	spec_fileZvendor_hookZproblemZfixedZ
fixed_hookZfieldvalZdef_setup_callZ	def_buildZinstall_cmdZscript_optionsZrpm_optattrdefaultr6r6r7rTs


	




zbdist_rpm._make_spec_filecCs|s|Sg}x`|dD]N}|}|ddkrD|d|gq|ddkr\||q|d|qW|ds||d=|S)zKFormat the changelog correctly and convert it to a list of strings
        rkrrrjrhz  )rZr[rVrI)r5rZ
new_changelogrcr6r6r7rJ3szbdist_rpm._format_changelogN)__name__
__module____qualname__ZdescriptionZuser_optionsZboolean_optionsZnegative_optr8rDrCrfrgrTrJr6r6r6r7r	sp--)r	)__doc__rrr>r;Zdistutils.corerZdistutils.debugrZdistutils.utilrZdistutils.file_utilrZdistutils.errorsZdistutils.sysconfigrZ	distutilsrr	r6r6r6r7<module>s