
|«‘_ä  ã               @   s/   d  d l  j j Z Gd d „  d e j ƒ Z d S)é    Nc               @   s.   e  Z d  Z d Z d d „  Z d d „  Z d S)Ú	bdist_rpmaf  
    Override the default bdist_rpm behavior to do the following:

    1. Run egg_info to ensure the name and version are properly calculated.
    2. Always run 'install' using --single-version-externally-managed to
       disable eggs in RPM distributions.
    3. Replace dash with underscore in the version numbers for better RPM
       compatibility.
    c             C   s!   |  j  d ƒ t j j |  ƒ d  S)NÚegg_info)Úrun_commandÚorigr   Úrun)Úself© r   úB/tmp/pip-build-3_sjtvrs/setuptools/setuptools/command/bdist_rpm.pyr      s    zbdist_rpm.runc                s”   |  j  j ƒ  } | j d d ƒ } t j j |  ƒ } d | ‰  d | ‰ ‡  ‡ f d d †  | Dƒ } | j ˆ ƒ d } d | } | j | | ƒ | S)Nú-Ú_z%define version c                sF   g  |  ]< } | j  d  d ƒ j  d d ƒ j  d d ƒ j  ˆ  ˆ ƒ ‘ q S)zSource0: %{name}-%{version}.tarz)Source0: %{name}-%{unmangled_version}.tarzsetup.py install z5setup.py install --single-version-externally-managed z%setupz&%setup -n %{name}-%{unmangled_version})Úreplace)Ú.0Úline)Úline23Úline24r   r	   ú
<listcomp>   s   	
z-bdist_rpm._make_spec_file.<locals>.<listcomp>é   z%define unmangled_version )ÚdistributionÚget_versionr   r   r   Ú_make_spec_fileÚindexÚinsert)r   ÚversionZ
rpmversionÚspecZ
insert_locZunmangled_versionr   )r   r   r	   r      s    




zbdist_rpm._make_spec_fileN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r	   r      s   	r   )Zdistutils.command.bdist_rpmÚcommandr   r   r   r   r   r	   Ú<module>   s   