o
    5‘ði\  ã                   @   s¶   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
Z
ddlmZ dZe
jdd	�d
d„ ƒZe
jjddd�Ze
j d¡e
j d¡e
j d¡G dd„ de	jƒƒƒƒZdS )z&Tests for distutils.command.bdist_rpm.é    N)Ú	bdist_rpm)ÚDistribution)Úsupport)Úrequires_zlibz–from distutils.core import setup
import foo

setup(name='foo', version='0.1', py_modules=['foo'],
      url='xxx', author='xxx', author_email='xxx')

T)Úautousec                   C   s2   z	t j d¡ W d S  ty   t d¡ Y d S w )NzUTF-8z(sys.executable is not encodable to UTF-8)ÚsysÚ
executableÚencodeÚUnicodeEncodeErrorÚpytestÚskip© r   r   úi/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist_rpm.pyÚsys_executable_encodable   s
   ÿr   z$not sys.platform.startswith('linux')z)spurious sdtout/stderr output under macOS)ÚreasonÚsave_envÚ	save_argvÚsave_cwdc                   @   s`   e Zd Zeeƒ ej d¡ej d¡dd„ ƒƒƒƒZeeƒ ej d¡ej d¡dd„ ƒƒƒƒZ	dS )ÚTestBuildRpmznot shutil.which('rpm')znot shutil.which('rpmbuild')c                 C   sþ   |   ¡ }|tjd< tj |d¡}t |¡ |  |dft¡ |  |dfd¡ |  |dfd¡ |  |dfd	¡ tdd
dgddddœƒ}d|_	t 
|¡ dgt_t|ƒ}d|_d|_| ¡  | ¡  t tj |d¡¡}d|v soJ ‚d|jv svJ ‚d|jv s}J ‚d S ©NÚHOMEÚfoozsetup.pyzfoo.pyú#zMANIFEST.inzinclude foo.pyÚREADMEÚ z0.1Úxxx)ÚnameÚversionÚ
py_modulesÚurlÚauthorÚauthor_emailTÚdistzfoo-0.1-1.noarch.rpm)r   Úanyzdist/foo-0.1-1.src.rpm)r   r#   zdist/foo-0.1-1.noarch.rpm)ÚmkdtempÚosÚenvironÚpathÚjoinÚmkdirÚ
write_fileÚSETUP_PYr   Úscript_nameÚchdirr   Úargvr   Ú
fix_pythonÚquietÚensure_finalizedÚrunÚlistdirÚ
dist_files©ÚselfÚtmp_dirÚpkg_dirr"   ÚcmdÚdist_createdr   r   r   Ú
test_quiet+   s8   

ú
zTestBuildRpm.test_quietc                 C   s  |   ¡ }|tjd< tj |d¡}t |¡ |  |dft¡ |  |dfd¡ |  |dfd¡ |  |dfd	¡ tdd
dgddddœƒ}d|_	t 
|¡ dgt_t|ƒ}d|_d|_| ¡  | ¡  t tj |d¡¡}d|v soJ ‚d|jv svJ ‚d|jv s}J ‚t tj |dd¡¡ d S r   )r$   r%   r&   r'   r(   r)   r*   r+   r   r,   r-   r   r.   r   r/   r0   r1   r2   r3   r4   Úremover5   r   r   r   Útest_no_optimize_flagU   s:   

ú
z"TestBuildRpm.test_no_optimize_flagN)
Ú__name__Ú
__module__Ú__qualname__Úmac_woesr   r   ÚmarkÚskipifr;   r=   r   r   r   r   r   %   s    

&

r   )Ú__doc__r%   Úshutilr   Údistutils.command.bdist_rpmr   Údistutils.corer   Údistutils.testsr   r   Útest.supportr   r+   Úfixturer   rB   rC   rA   ÚusefixturesÚTempdirManagerr   r   r   r   r   Ú<module>   s,    


þ



ÿ