3 \�T�@s|ddlZddlZddlZddlmZddlmZddlmZddl m Z ddl Tddl m Z ddlmZGd d �d e�ZdS) �N)�Command)�DEBUG)� get_platform)� write_file)�*)�get_python_version)�logc+@s�eZdZdZdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{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�Z dcdd�Z dedf�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 ") [default: maintainer or author from setup script]� packager=�BRPM packager (eg. "Jane Doe ") [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=�rnro�README� README.txtrk�1rlrirprqrrrsrtrurvrwrxryrzr|r}r~rr�r�)r�r�)Z ensure_stringr�Z get_contactZget_contact_emailZensure_string_list� isinstancero�listr�r��exists�append�_format_changelogrpZensure_filename)r�Zreadmer�r�r�r��s>                         zbdist_rpm.finalize_package_datac Cs�tr�sz-bdist_rpm._make_spec_file..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� ZUNKNOWNzUrl: 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_FILESr{rr�&%setup -n %{name}-%{unmangled_version}ZbuildrsZinstallrt�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{rrr�)r�rur�)r�rvN)r�rwN)r�rxN)r�ryN)r�rzN)'r�r�Z get_version�replacerkZget_description� subprocessZ getoutputr�� splitlinesr�r�rhZ get_licenserjr�r��getattr�lowerr�r�Zget_urlrirrqr�r�r�r�Zget_long_descriptionrcr��argvr��open�readr�rorp)r�Z spec_fileZ vendor_hookZproblemZfixedZ fixed_hookZfield�valZdef_setup_callZ def_buildZ install_cmdZscript_optionsZrpm_opt�attr�defaultr�r�r�r��s�                   zbdist_rpm._make_spec_filecCs�|s|Sg}x`|j�jd�D]N}|j�}|ddkrD|jd|g�q|ddkr\|j|�q|jd|�qW|ds||d=|S)Nr�rrr�r�z )r�r�r�r�)r�rpZ new_changelogr�r�r�r�r�3s   zbdist_rpm._format_changelog)r Nr )r Nr )rrr)rNr)rNr)rNr)rNr)rNr)rNr)rNr)rNr )r!Nr")r#Nr$)r%Nr&)r'Nr()r)Nr*)r+Nr,)r-Nr.)r/Nr0)r1Nr2)r3Nr4)r5Nr6)r7Nr8)r9Nr:)r;r<r=)r>Nr?)r@NrA)rBNrC)rDNrE)rFNrG)rHNrI)rJNrK)rLNrM)rNNrO)rPNrQ)rRNrS)rTNrU)rVNrW)rXNrY)rZNr[)r\r]r^)�__name__� __module__� __qualname__Z descriptionZ user_optionsZboolean_optionsZ negative_optr�r�r�r�r�r�r�r�r�r�r�r s�--)r )r�r�r�Zdistutils.corerZdistutils.debugrZdistutils.utilrZdistutils.file_utilrZdistutils.errorsZdistutils.sysconfigrZ distutilsrr r�r�r�r��s