MINI MINI MANI MO
3
  \T                 @   s   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlT ddl
mZ dd	lmZ G d
d deZdS )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~dddddddddddddddddg)Zd4d9d=d2dUgZd4d9d=dXZdYdZ Zd[d\ Zd]d^ Z	d_d` Z
dadb Zdcdd Zdedf Z
dS )	bdist_rpmzcreate an RPM distributionbdist-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=dDdirectory 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-pythonLhard-code the exact path to the current Python interpreter in the .spec file	spec-onlyonly regenerate spec filesource-onlyonly generate source RPMbinary-onlyonly generate binary RPM	use-bzip27use bzip2 instead of gzip to create source distributiondistribution-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 numberserial=RPM serial numbervendor=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 changelogicon=name of icon file	provides=%capabilities provided by this package	requires=%capabilities required by this package
conflicts=-capabilities which conflict with this packagebuild-requires=+capabilities required to build this package
obsoletes=*capabilities made obsolete by this package
no-autoreq+do not automatically calculate dependencies	keep-tempk"don't clean up RPM build directoryno-keep-temp&clean up RPM build directory [default]use-rpm-opt-flags8compile with RPM_OPT_FLAGS when building from source RPMno-rpm-opt-flags&do not pass any RPM CFLAGS to compiler	rpm3-mode"RPM 3 compatibility mode (default)	rpm2-modeRPM 2 compatibility modeprep-script=3Specify a script for the PREP phase of RPM building
build-script=4Specify a script for the BUILD phase of RPM buildingpre-install=:Specify a script for the pre-INSTALL phase of RPM buildinginstall-script=6Specify a script for the INSTALL phase of RPM building
post-install=;Specify a script for the post-INSTALL phase of RPM buildingpre-uninstall=<Specify a script for the pre-UNINSTALL phase of RPM buildingpost-uninstall==Specify a script for the post-UNINSTALL phase of RPM building
clean-script=4Specify a script for the CLEAN phase of RPM buildingverify-script=6Specify a script for the VERIFY phase of the RPM buildforce-arch=0Force an architecture onto the RPM build processquietq3Run 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_baserpm_basedist_dirpython
fix_python	spec_onlybinary_onlysource_only	use_bzip2distribution_namegroupreleaseserialvendorpackager	doc_files	changelogiconprep_scriptbuild_scriptinstall_scriptclean_script
verify_scriptpre_installpost_install
pre_uninstallpost_uninstallprepprovidesrequires	conflictsbuild_requires	obsoletes	keep_tempuse_rpm_opt_flags	rpm3_mode
no_autoreq
force_archr\   )self r   3/usr/lib64/python3.6/distutils/command/bdist_rpm.pyinitialize_options   sN    zbdist_rpm.initialize_optionsc             C   s   | j dd | jd kr6| js$tdtjj| jd| _| jd krX| j	rPt
j| _qfd| _n| j	rftdtjdkr~t
dtj | jr| jrtd	| jj sd
| _| j dd
 | j  d S )NZbdistr`   z)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   rb   )r`   r`   )rb   rb   )Zset_undefined_optionsra   r   ZDistutilsOptionErrorospathjoinr`   rc   rd   sys
executablenameZDistutilsPlatformErrorrf   rg   distributionhas_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| jtr|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   existsappend_format_changelogrp   Zensure_filename)r   Zreadmer   r   r   r      s>