Your IP : 3.137.177.204


Current Path : /opt/alt/python39/lib64/python3.9/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/distutils/command/__pycache__/bdist_rpm.cpython-39.pyc

a

R�f!T�@stdZddlZddlZddlZddlmZddlmZddlm	Z	ddl
TddlmZddl
mZGd	d
�d
e�ZdS)zwdistutils.command.bdist_rpm

Implements the Distutils 'bdist_rpm' command (create RPM source and binary
distributions).�N)�Command)�DEBUG)�
write_file)�*)�get_python_version)�logc@sdeZdZdZgd�Zgd�Zdddd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�	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)�
no-autoreqNz+do not automatically calculate dependencies)�	keep-temp�kz"don't clean up RPM build directory)�no-keep-tempNz&clean up RPM build directory [default])�use-rpm-opt-flagsNz8compile with RPM_OPT_FLAGS when building from source RPM)�no-rpm-opt-flagsNz&do not pass any RPM CFLAGS to compiler)�	rpm3-modeNz"RPM 3 compatibility mode (default))�	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)�quiet�qz3Run the INSTALL phase of RPM building in quiet mode)rrrr
rrrr)r
rrcCs�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|_%d|_&dS)Nr�)'�
bdist_base�rpm_base�dist_dir�python�
fix_python�	spec_only�binary_only�source_only�	use_bzip2�distribution_name�group�release�serial�vendor�packager�	doc_files�	changelog�icon�prep_script�build_script�install_script�clean_script�
verify_script�pre_install�post_install�
pre_uninstall�post_uninstall�prep�provides�requires�	conflicts�build_requires�	obsoletes�	keep_temp�use_rpm_opt_flags�	rpm3_mode�
no_autoreq�
force_archr��self�r=�@/opt/alt/python39/lib64/python3.9/distutils/command/bdist_rpm.py�initialize_options�sNzbdist_rpm.initialize_optionscCs�|�dd�|jdur6|js$td��tj�|jd�|_|jdurX|j	rPt
j|_qfd|_n|j	rftd��tjdkr~t
dtj��|jr�|jr�td	��|j��s�d
|_|�dd�|��dS)NZbdist)rrz)you must specify --rpm-base in RPM 2 mode�rpmZpython3z8--python and --fix-python are mutually exclusive options�posixz9don't know how to create RPM distributions on platform %sz6cannot supply both '--source-only' and '--binary-only'r)rr)Zset_undefined_optionsrr8ZDistutilsOptionError�os�path�joinrrr�sys�
executable�nameZDistutilsPlatformErrorrr�distribution�has_ext_modulesr7�finalize_package_datar;r=r=r>�finalize_options�s6
�

�
��
zbdist_rpm.finalize_optionscCsT|�dd�|�dd|j��|j��f�|�d�|�d�t|jt�rxdD]&}tj	�
|�rP||jvrP|j�|�qP|�dd	�|�d
�|�d�|�d�|�|j
�|_
|�d
�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�dS)NrzDevelopment/Librariesr"z%s <%s>r#r$)ZREADMEz
README.txtr �1r!rr%r&r'r(r)r*r+r,r-r.r/r1r2r3r4r5r:)Z
ensure_stringrHZget_contactZget_contact_emailZensure_string_list�
isinstancer$�listrBrC�exists�append�_format_changelogr%Zensure_filename)r<Zreadmer=r=r>rJ�sB
��



















zbdist_rpm.finalize_package_datacCs�tr<td�td|j�td|j�td|j�td|j�|jrT|j}|�|�n8i}dD]&}t	j
�|j|�||<|�||�q\|d}t	j
�|d|j
���}|�t||��fd	|�|jr�dS|j
jdd�}|�d
�}|jr�dg|_ndg|_|�d
�||j
_|��d
}|d}|�||�|j�rbt	j
�|j��rT|�|j|�ntd|j��t�d�dg}	|j�r�|	�d�n|j �r�|	�d�n
|	�d�|	�!dd|j"g�|j#�r�|	�!ddt	j
�$|j�g�|j%�s�|	�d�|j&�r|	�d�|	�|�d}
|
d}d|
d}d|||f}
t	�'|
�}z�g}d}|�(�}|�sV�q�|�)��*�}t+|�dk�stJ�|�|d �|du�rD|d
}�qD|�,�}|�r�t-d!t.|
���W|�,�n
|�,�0|�/|	�|j0�s�|j
�1��r�t2�}nd"}|j �sTt	j
�|d#|�}t	j
�|��s"J�|�3||j�t	j
�|j|�}|j
j�d$||f�|j�s�|D]`}t	j
�|d%|�}t	j
�|��r`|�3||j�t	j
�|jt	j
�4|��}|j
j�d$||f��q`dS)&Nzbefore _get_package_data():zvendor =z
packager =zdoc_files =zchangelog =)�SOURCES�SPECSZBUILD�RPMS�SRPMSrSz%s.speczwriting '%s'�sdistZbztarZgztarrrRzicon file '%s' does not existz
building RPMsZrpmbuildz-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: %s�anyrUrrT)5r�printr"r#r$r%rrZmkpathrBrCrDrrH�get_nameZexecuter�_make_spec_fileZ
dist_filesZreinitialize_commandrZformatsZrun_commandZget_archive_filesZ	copy_filer&rOZDistutilsFileErrorr�inforrPr�extendrr8�abspathr6r�popen�readline�strip�split�len�closeZDistutilsExecError�reprZspawnZdry_runrIrZ	move_file�basename)r<Zspec_dirZrpm_dirr	Z	spec_pathZsaved_dist_filesrV�sourceZ
source_dirZrpm_cmdZ
nvr_stringZsrc_rpmZnon_src_rpmZq_cmd�outZbinary_rpmsZ
source_rpm�line�lZstatusZ	pyversionZsrpm�filenamer@r=r=r>�runs����


�

�


�


�

��z
bdist_rpm.runcCstj�|jtj�|��S)N)rBrCrDrrf)r<rCr=r=r>�
_dist_path�szbdist_rpm._dist_pathc	Cs\d|j��d|j���dd�d|j��d|j�dd�dd|j��g}t�d	�}d
�dd�|�	�D��}d
}d}|�||�}||kr�|�
d�|�
d|d
�|�gd��|jr�|�
d�n
|�
d�|�d|j�
�d|jddg�|j�s|j���s$|�
d�n|�
d|j�dD]V}t||���}t|t��r`|�
d|d�|�f�n|du�r(|�
d||f��q(|j��dk�r�|�
d|j���|j�r�|�
d |j�|j�r�|�
d!d�|j��|j�r�|�
d"tj�|j��|j�r|�
d#�|�dd$|j��g�d%|jtj�tj d&�f}d'|}	|j!�rVd(|	}	d)|}
d*d+d,|	fd-d.|
fd/d0d1d2d3d4g	}|D]�\}}
}t||
�}|�s�|�r�|�dd5|g�|�r�t"|��$}|�|�#��$d
��Wd�n1�s�0Yn
|�
|��q�|�gd6��|j%�r6|�
d7d�|j%��|j&�rX|�dd8g�|�|j&�|S)9ziGenerate 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 \)ra)�.0rir=r=r>�
<listcomp>�s�z-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)r0r'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�%)rpz%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z
%changelog)'rHrZZget_version�replacer Zget_description�
subprocessZ	getoutputrD�
splitlinesrPr]rZget_licenserr:rI�getattr�lowerrMrNZget_urlrr4r&rBrCrfr9Zget_long_descriptionrrE�argvr7�open�readrbr$r%)r<Z	spec_fileZvendor_hookZproblemZfixedZ
fixed_hookZfield�valZdef_setup_callZ	def_buildZinstall_cmdZscript_optionsZrpm_opt�attr�default�fr=r=r>r[�s��

�
	
�

�
���
�
6�zbdist_rpm._make_spec_filecCs||s|Sg}|���d�D]N}|��}|ddkrB|�d|g�q|ddkrZ|�|�q|�d|�q|dsx|d=|S)zKFormat the changelog correctly and convert it to a list of strings
        rqrrrprnz  )rarbr]rP)r<r%Z
new_changelogrir=r=r>rQ0szbdist_rpm._format_changelogN)�__name__�
__module__�__qualname__ZdescriptionZuser_optionsZboolean_optionsZnegative_optr?rKrJrlrmr[rQr=r=r=r>rs m�--*r)�__doc__rwrErBZdistutils.corerZdistutils.debugrZdistutils.file_utilrZdistutils.errorsZdistutils.sysconfigrZ	distutilsrrr=r=r=r>�<module>s

?>