3 \§Tã@s€dZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl Tddl mZdd lmZGd d „d eƒ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¸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ú 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_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)zKFormat the changelog correctly and convert it to a list of strings r¿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 )Ú__doc__rÔr�rŒZdistutils.corerZdistutils.debugrZdistutils.utilrZdistutils.file_utilrZdistutils.errorsZdistutils.sysconfigrZ distutilsrr r‡r‡r‡rˆÚs