<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
B
    ‘–Reo@  ã               @   sd   d Z ddlZddlZddlZddlZddlmZ ddlT ddl	m
Z
 ddlmZ G dd„ deƒZdS )	zHdistutils.command.build_py

Implements the Distutils 'build_py' command.é    N)ÚCommand)Ú*)Úconvert_path)Úlogc               @   sÈ   e Zd ZdZdddddgZddgZd	diZd
d„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd2d'd(„Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd1S )3Úbuild_pyz5"build" pure Python modules (copy to build directory))z
build-lib=Údzdirectory to "build" (copy) to)ÚcompileÚczcompile .py to .pyc)z
no-compileNz!don't compile .py files [default])z	optimize=ÚOzlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])ÚforceÚfz2forcibly build everything (ignore file timestamps)r   r   z
no-compilec             C   s4   d | _ d | _d | _d | _d | _d| _d| _d | _d S )Nr   )Ú	build_libÚ
py_modulesÚpackageÚpackage_dataÚpackage_dirr   Úoptimizer   )Úself© r   úœ/builddir/build/BUILDROOT/alt-python37-setuptools-58.3.0-4.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/setuptools/_distutils/command/build_py.pyÚinitialize_options    s    zbuild_py.initialize_optionsc          	   C   sÊ   |   ddd¡ | jj| _| jj| _| jj| _i | _| jjrbx&| jj ¡ D ]\}}t|ƒ| j|< qHW |  ¡ | _	t
| jtƒsÆy,t| jƒ| _d| j  krœdks¢n t‚W n  ttfk
rÄ   tdƒ‚Y nX d S )NÚbuild)r   r   )r   r   r   é   zoptimize must be 0, 1, or 2)Úset_undefined_optionsÚdistributionÚpackagesr   r   r   Úitemsr   Úget_data_filesÚ
data_filesÚ
isinstancer   ÚintÚAssertionErrorÚ
ValueErrorÚDistutilsOptionError)r   ÚnameÚpathr   r   r   Úfinalize_options*   s"    



 zbuild_py.finalize_optionsc             C   s:   | j r|  ¡  | jr$|  ¡  |  ¡  |  | jdd¡ d S )Nr   )Úinclude_bytecode)r   Úbuild_modulesr   Úbuild_packagesÚbuild_package_dataÚbyte_compileÚget_outputs)r   r   r   r   ÚrunC   s    zbuild_py.runc                s†   g }| j s|S xr| j D ]h}|  |¡}tjj| jg| d¡ Ž }d‰ |rRt|ƒd ‰ ‡ fdd„|  ||¡D ƒ}| 	||||f¡ qW |S )z?Generate list of '(package,src_dir,build_dir,filenames)' tuplesÚ.r   é   c                s   g | ]}|ˆ d … ‘qS )Nr   )Ú.0Úfile)Úplenr   r   ú
<listcomp>t   s    z+build_py.get_data_files.<locals>.<listcomp>)
r   Úget_package_dirÚosr%   Újoinr   ÚsplitÚlenÚfind_data_filesÚappend)r   Údatar   Úsrc_dirÚ	build_dirÚ	filenamesr   )r2   r   r   a   s    
zbuild_py.get_data_filesc                sh   | j  dg ¡| j  |g ¡ }g ‰ xB|D ]:}t tj t |¡t|ƒ¡¡}ˆ  ‡ fdd„|D ƒ¡ q&W ˆ S )z6Return filenames for package's data files in 'src_dir'Ú c                s$   g | ]}|ˆ krt j |¡r|‘qS r   )r5   r%   Úisfile)r0   Úfn)Úfilesr   r   r3   ‚   s    
z,build_py.find_data_files.<locals>.<listcomp>)	r   ÚgetÚglobr5   r%   r6   Úescaper   Úextend)r   r   r<   ZglobsÚpatternÚfilelistr   )rB   r   r9   y   s    
zbuild_py.find_data_filesc             C   sh   d}x^| j D ]T\}}}}xF|D ]>}tj ||¡}|  tj |¡¡ | jtj ||¡|dd qW qW dS )z$Copy data files into build directoryNF)Úpreserve_mode)r   r5   r%   r6   ÚmkpathÚdirnameÚ	copy_file)r   Zlastdirr   r<   r=   r>   ÚfilenameÚtargetr   r   r   r*   †   s    
zbuild_py.build_package_datac             C   sÄ   |  d¡}| js&|r tjj|Ž S dS nšg }x”|rŠy| jd |¡ }W n* tk
rn   | d|d ¡ |d= Y q,X | d|¡ tjj|Ž S q,W | j d¡}|dk	r¬| d|¡ |r¼tjj|Ž S dS dS )z½Return the directory, relative to the top of the source
           distribution, where package 'package' should be found
           (at least according to the 'package_dir' option, if any).r.   r?   r   éÿÿÿÿN)r7   r   r5   r%   r6   ÚKeyErrorÚinsertrC   )r   r   r%   ÚtailZpdirr   r   r   r4      s(    
	zbuild_py.get_package_dirc             C   sj   |dkr8t j |¡s td| ƒ‚t j |¡s8td| ƒ‚|rft j |d¡}t j |¡rZ|S t d|¡ d S )Nr?   z%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz__init__.pyz8package init file '%s' not found (or not a regular file))	r5   r%   ÚexistsÚDistutilsFileErrorÚisdirr6   r@   r   Úwarn)r   r   r   Úinit_pyr   r   r   Úcheck_package·   s    
zbuild_py.check_packagec             C   s&   t j |¡st d||¡ dS dS d S )Nz!file %s (for module %s) not foundFT)r5   r%   r@   r   rV   )r   ÚmoduleÚmodule_filer   r   r   Úcheck_moduleÒ   s    zbuild_py.check_modulec       	      C   s˜   |   ||¡ t tj t |¡d¡¡}g }tj | jj¡}xX|D ]P}tj |¡}||kr‚tj 	tj 
|¡¡d }| |||f¡ q@|  d| ¡ q@W |S )Nz*.pyr   zexcluding %s)rX   rD   r5   r%   r6   rE   Úabspathr   Úscript_nameÚsplitextÚbasenamer:   Údebug_print)	r   r   r   Zmodule_filesÚmodulesZsetup_scriptr   Zabs_frY   r   r   r   Úfind_package_modulesÙ   s    
zbuild_py.find_package_modulesc          	   C   sÔ   i }g }xÆ| j D ]¼}| d¡}d |dd… ¡}|d }y|| \}}W n" tk
rj   |  |¡}d}Y nX |sœ|  ||¡}	|df||< |	rœ| |d|	f¡ tj ||d ¡}
|  	||
¡s¼q| |||
f¡ qW |S )aÈ  Finds individually-specified Python modules, ie. those listed by
        module name in 'self.py_modules'.  Returns a list of tuples (package,
        module_base, filename): 'package' is a tuple of the path through
        package-space to the module; 'module_base' is the bare (no
        packages, no dots) module name, and 'filename' is the path to the
        ".py" file (relative to the distribution root) that implements the
        module.
        r.   r   rO   r/   Ú__init__z.py)
r   r7   r6   rP   r4   rX   r:   r5   r%   r[   )r   r   ra   rY   r%   r   Zmodule_baser   ÚcheckedrW   rZ   r   r   r   Úfind_modulesè   s*    


zbuild_py.find_modulesc             C   sR   g }| j r| |  ¡ ¡ | jrNx.| jD ]$}|  |¡}|  ||¡}| |¡ q&W |S )a4  Compute the list of all modules that will be built, whether
        they are specified one-module-at-a-time ('self.py_modules') or
        by whole packages ('self.packages').  Return a list of tuples
        (package, module, module_file), just like 'find_modules()' and
        'find_package_modules()' do.)r   rF   re   r   r4   rb   )r   ra   r   r   Úmr   r   r   Úfind_all_modules  s    
zbuild_py.find_all_modulesc             C   s   dd„ |   ¡ D ƒS )Nc             S   s   g | ]}|d  ‘qS )rO   r   )r0   rY   r   r   r   r3   -  s    z-build_py.get_source_files.<locals>.<listcomp>)rg   )r   r   r   r   Úget_source_files,  s    zbuild_py.get_source_filesc             C   s$   |gt |ƒ |d g }tjj|Ž S )Nz.py)Úlistr5   r%   r6   )r   r=   r   rY   Zoutfile_pathr   r   r   Úget_module_outfile/  s    zbuild_py.get_module_outfiler/   c             C   sž   |   ¡ }g }xx|D ]p\}}}| d¡}|  | j||¡}| |¡ |r| jr`| tjj|dd¡ | j	dkr| tjj|| j	d¡ qW |dd„ | j
D ƒ7 }|S )Nr.   r?   )Úoptimizationr   c             S   s,   g | ]$\}}}}|D ]}t j ||¡‘qqS r   )r5   r%   r6   )r0   r   r<   r=   r>   rM   r   r   r   r3   C  s   
z(build_py.get_outputs.<locals>.<listcomp>)rg   r7   rj   r   r:   r   Ú	importlibÚutilÚcache_from_sourcer   r   )r   r'   ra   Úoutputsr   rY   rZ   rM   r   r   r   r,   3  s"    




zbuild_py.get_outputsc             C   sb   t |tƒr| d¡}nt |ttfƒs,tdƒ‚|  | j||¡}tj	 
|¡}|  |¡ | j||ddS )Nr.   z:'package' must be a string (dot-separated), list, or tupler   )rI   )r   Ústrr7   ri   ÚtupleÚ	TypeErrorrj   r   r5   r%   rK   rJ   rL   )r   rY   rZ   r   ÚoutfileÚdirr   r   r   Úbuild_moduleJ  s    

zbuild_py.build_modulec             C   s.   |   ¡ }x |D ]\}}}|  |||¡ qW d S )N)re   ru   )r   ra   r   rY   rZ   r   r   r   r(   Y  s    zbuild_py.build_modulesc             C   sX   xR| j D ]H}|  |¡}|  ||¡}x,|D ]$\}}}||ks>t‚|  |||¡ q(W qW d S )N)r   r4   rb   r!   ru   )r   r   r   ra   Zpackage_rY   rZ   r   r   r   r)   b  s    

zbuild_py.build_packagesc             C   s€   t jr|  d¡ d S ddlm} | j}|d tjkr>|tj }| jrZ||d| j	|| j
d | jdkr|||| j| j	|| j
d d S )Nz%byte-compiling is disabled, skipping.r   )r+   rO   )r   r   ÚprefixÚdry_run)ÚsysÚdont_write_bytecoderV   Údistutils.utilr+   r   r5   Úsepr   r   rw   r   )r   rB   r+   rv   r   r   r   r+   v  s    


zbuild_py.byte_compileN)r/   )Ú__name__Ú
__module__Ú__qualname__ÚdescriptionÚuser_optionsÚboolean_optionsÚnegative_optr   r&   r-   r   r9   r*   r4   rX   r[   rb   re   rg   rh   rj   r,   ru   r(   r)   r+   r   r   r   r   r      s6   

'4
	r   )Ú__doc__r5   Úimportlib.utilrl   rx   rD   Údistutils.corer   Údistutils.errorsrz   r   Ú	distutilsr   r   r   r   r   r   Ú<module>   s   