Edit File: bdist_rpm.cpython-36.pyc
3 � \�T������������������@���s����d�Z�ddlZddlZddlZddlmZ�ddlmZ�ddlm Z �ddl mZ�ddlT�ddl mZ�dd lmZ�G�d d��de�ZdS�)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������������+���@���s����e�Zd�ZdZdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�g)Zd4d9d=d2dUgZd4d9d=dX�ZdYdZ��Zd[d\��Zd]d^��Z d_d`��Z dadb��Zdcdd��Zdedf��Z dS�)�� bdist_rpmzcreate an RPM distribution�bdist-base=N�/base directory for creating built distributions� rpm-base=�dbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2)� dist-dir=�d�Ddirectory to put final RPM files in (and .spec files if --spec-only)�python=�Mpath to Python interpreter to hard-code in the .spec file (default: "python")� fix-python�Lhard-code the exact path to the current Python interpreter in the .spec file� spec-only�only regenerate spec file�source-only�only generate source RPM�binary-only�only generate binary RPM� use-bzip2�7use bzip2 instead of gzip to create source distribution�distribution-name=�gname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!)�group=�9package classification [default: "Development/Libraries"]�release=�RPM release number�serial=�RPM serial number�vendor=�aRPM "vendor" (eg. "Joe Blow <joe@example.com>") [default: maintainer or author from setup script]� packager=�BRPM packager (eg. "Jane Doe <jane@example.net>") [default: vendor]� doc-files=�6list of documentation files (space or comma-separated)� changelog=� RPM changelog�icon=�name of icon file� provides=�%capabilities provided by this package� requires=�%capabilities required by this package� conflicts=�-capabilities which conflict with this package�build-requires=�+capabilities required to build this package� obsoletes=�*capabilities made obsolete by this package� no-autoreq�+do not automatically calculate dependencies� keep-temp�k�"don't clean up RPM build directory�no-keep-temp�&clean up RPM build directory [default]�use-rpm-opt-flags�8compile with RPM_OPT_FLAGS when building from source RPM�no-rpm-opt-flags�&do not pass any RPM CFLAGS to compiler� rpm3-mode�"RPM 3 compatibility mode (default)� rpm2-mode�RPM 2 compatibility mode�prep-script=�3Specify a script for the PREP phase of RPM building� build-script=�4Specify a script for the BUILD phase of RPM building�pre-install=�:Specify a script for the pre-INSTALL phase of RPM building�install-script=�6Specify a script for the INSTALL phase of RPM building� post-install=�;Specify a script for the post-INSTALL phase of RPM building�pre-uninstall=�<Specify a script for the pre-UNINSTALL phase of RPM building�post-uninstall=�=Specify a script for the post-UNINSTALL phase of RPM building� clean-script=�4Specify a script for the CLEAN phase of RPM building�verify-script=�6Specify a script for the VERIFY phase of the RPM build�force-arch=�0Force an architecture onto the RPM build process�quiet�q�3Run the INSTALL phase of RPM building in quiet mode)zno-keep-tempzno-rpm-opt-flagsz rpm2-modec�������������C���s����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|�_&d�S�)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�����3/usr/lib64/python3.6/distutils/command/bdist_rpm.py�initialize_options����sN����zbdist_rpm.initialize_optionsc�������������C���s����|�j�dd��|�jd�kr6|�js$td��tjj|�jd�|�_|�jd�krX|�j rPt j|�_qfd|�_n|�j rftd��tjdkr~t dtj���|�jr�|�jr�td ��|�jj��s�d |�_|�j�dd ��|�j���d�S�)NZbdistr`���z)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���rb���)r`���r`���)rb���rb���)Zset_undefined_optionsra���r����ZDistutilsOptionError�os�path�joinr`���rc���rd����sys� executable�nameZDistutilsPlatformErrorrf���rg����distribution�has_ext_modulesr�����finalize_package_data)r����r����r����r�����finalize_options����s.���� zbdist_rpm.finalize_optionsc�������������C���sX��|�j�dd��|�j�dd|�jj��|�jj��f���|�j�d��|�jd��t|�jt�r|x.dD�]&}tj j |�rR||�jkrR|�jj|��qRW�|�j�d d ��|�j�d��|�j�d��|�j�d ��|�j|�j �|�_ |�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�jd��|�j�d��d�S�)Nrj���zDevelopment/Librariesrm���z%s <%s>rn���ro����README� README.txtrk����1rl���ri���rp���rq���rr���rs���rt���ru���rv���rw���rx���ry���rz���r|���r}���r~���r���r����r����)r����r����)Z ensure_stringr����Zget_contactZget_contact_emailZensure_string_list� isinstancero����listr����r�����exists�append�_format_changelogrp���Zensure_filename)r����Zreadmer����r����r����r��������s>���� zbdist_rpm.finalize_package_datac���������� ���C���s���t�r<td��td|�j��td|�j��td|�j��td|�j��|�jrT|�j}|�j|��n<i�}x.d)D�]&}t j j|�j|�||<�|�j||���q^W�|d�}t j j|d|�j j����}|�jt||�j��fd|���|�jr�d�S�|�j jd�d���}|�jd �}|�j��r�dg|_ndg|_|�jd ��||�j _|j��d�}|d�}|�j||��|�j�rht j j|�j��rZ|�j|�j|��ntd|�j���tjd��dg} t j jd��s�t j jd��r�dg} |�j�r�| jd��n|�j �r�| jd��n | jd��| j!dd|�j"�g��|�j#�r| j!ddt j j$|�j��g��|�j%�s| jd��|�j&�r(| jd��| j|��d} | d �}d!| �d"�}d#|||f�} t j'| �}z�g�}d�}xT|j(��}|�s~P�|j)��j*��}t+|�d$k�s�t,�|j|d%���|d�k�rn|d�}�qnW�|j-��}|�r�t.d&t/| ����W�d�|j-���X�|�j0| ��|�j1�s�|�j j2���rt3��}nd'}|�j �svt j j|d �|�}t j j|��sDt,�|�j4||�j��t j j|�j|�}|�j jjd(||f��|�j�s�xh|D�]`}t j j|d �|�}t j j|��r�|�j4||�j��t j j|�jt j j5|��}|�j jjd(||f���q�W�d�S�)*Nzbefore _get_package_data():zvendor =z packager =zdoc_files =zchangelog =�SOURCES�SPECS�BUILD�RPMS�SRPMSz%s.speczwriting '%s'�sdistZbztarZgztarr���zicon file '%s' does not existz building RPMsr����z/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'����r_���zFailed to execute: %s�anyr ���)r����r����r����r����r����)6r����printrm���rn���ro���rp���re���rb���Zmkpathr����r����r����ra���r�����get_nameZexecuter����_make_spec_fileZ dist_filesZreinitialize_commandrh���ZformatsZrun_commandZget_archive_filesZ copy_filerq���r����ZDistutilsFileErrorr����inforg���r����rf����extendrc���r�����abspathr����r\����popen�readline�strip�split�len�AssertionError�closeZDistutilsExecError�reprZspawnZdry_runr����r���Z move_file�basename)r����Zspec_dirZrpm_dirr���Z spec_pathZsaved_dist_filesr�����sourceZ source_dirZrpm_cmdZ nvr_stringZsrc_rpmZnon_src_rpmZq_cmd�outZbinary_rpmsZ source_rpm�line�lZstatusZ pyversionZsrpm�filenamer����r����r����r�����run��s����� z bdist_rpm.runc�������������C���s���t�jj|�jt�jj|��S�)N)r����r����r����rb���r����)r����r����r����r����r����� _dist_path���s����zbdist_rpm._dist_pathc�������������C���sD��d|�j�j���d|�j�j��jdd��d|�j�j���d|�jjdd��dd|�j�j���g}tjd �}d jdd��|j ��D���}d }d}|j||�}||kr�|j d��|j d|�d ���|jdddg��|�jr�|j d��n |j d��|jd|�j�j ���d|�j�ddg��|�j�s|�j�j���s&|j d��n|j d|�j���x^dKD�]V}t|�|j���}t|t��rd|j d"|d#j|�f���n|d$k �r,|j d"||f����q,W�|�j�j��d%k�r�|j d&|�j�j�����|�j�r�|j d'|�j���|�j�r�|j d(d#j|�j����|�j�r�|j d)tjj|�j����|�j�r|j d*��|jdd+|�j�j��g��d,|�jtjjtj d-��f�}d.|�} |�j!�r\d/| �} d0|�} dLd4d5| fd6d7| fdMdNdOdPdQdRg }xh|D�]`\}} }t|�| �}|�s�|�r�|jddE|�g��|�r�|jt"|dF�j#��j$d ���n |j |���q�W�|jddGdHg��|�j%�r|j dId#j|�j%����|�j&�r@|jddJg��|j|�j&��|S�)SziGenerate 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}� c�������������S���s���g�|�]}d�|j�����qS�)z %s \)r����)�.0r����r����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�Vendor�Packager�Provides�Requires� Conflicts� Obsoletesz%s: %s� NZUNKNOWNzUrl: zDistribution: zBuildRequires: zIcon: z AutoReq: 0z%descriptionz%s %sr���z%s buildzenv CFLAGS="$RPM_OPT_FLAGS" z>%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILESr{���rr����&%setup -n %{name}-%{unmangled_version}Zbuildrs���Zinstallrt����cleanru����rm -rf $RPM_BUILD_ROOT�verifyscriptrv����prerw����postrx����preunry����postunrz����%�rz%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z %changelog)r����r����r����r����r����r����)r{���rr���r����)r����ru���r����)r����rv���N)r����rw���N)r����rx���N)r����ry���N)r����rz���N)'r����r����Zget_version�replacerk���Zget_description� subprocessZ getoutputr����� splitlinesr����r����rh���Zget_licenserj���r����r�����getattr�lowerr����r����Zget_urlri���r���rq���r����r����r����r����Zget_long_descriptionrc���r�����argvr�����open�readr����ro���rp���)r����Z spec_fileZvendor_hookZproblemZfixedZ fixed_hookZfield�valZdef_setup_callZ def_buildZinstall_cmdZscript_optionsZrpm_opt�attr�defaultr����r����r����r�������s����� ���� zbdist_rpm._make_spec_filec�������������C���s����|s|S�g�}x`|j���jd�D�]N}|j���}|d�dkrD|jd|g��q|d�dkr\|j|��q|jd|���qW�|d�s||d=�|S�)zKFormat the changelog correctly and convert it to a list of strings r����r���r���r����r����z )r����r����r����r����)r����rp���Z new_changelogr����r����r����r����r����3��s����zbdist_rpm._format_changelog)r ���Nr���)r���Nr ���)r���r���r���)r���Nr���)r���Nr���)r���Nr���)r���Nr���)r���Nr���)r���Nr���)r���Nr���)r���Nr ���)r!���Nr"���)r#���Nr$���)r%���Nr&���)r'���Nr(���)r)���Nr*���)r+���Nr,���)r-���Nr.���)r/���Nr0���)r1���Nr2���)r3���Nr4���)r5���Nr6���)r7���Nr8���)r9���Nr:���)r;���r<���r=���)r>���Nr?���)r@���NrA���)rB���NrC���)rD���NrE���)rF���NrG���)rH���NrI���)rJ���NrK���)rL���NrM���)rN���NrO���)rP���NrQ���)rR���NrS���)rT���NrU���)rV���NrW���)rX���NrY���)rZ���Nr[���)r\���r]���r^���)�__name__� __module__�__qualname__ZdescriptionZuser_optionsZboolean_optionsZnegative_optr����r����r����r����r����r����r����r����r����r����r����r ������s���������������������������������������������--��)r ���)�__doc__r����r����r����Zdistutils.corer���Zdistutils.debugr���Zdistutils.utilr���Zdistutils.file_utilr���Zdistutils.errorsZdistutils.sysconfigr���Z distutilsr���r ���r����r����r����r�����<module>���s���