a
    dM                     @   s   d dl Z d dlZd dlmZmZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZ d dlmZ dZejed	Zejed
ZejddZeeejdd ZeeedddZedddZeee
f dddZeee
f dddZdS )    N)module_from_specspec_from_file_locationPath)
ModuleType)AnyDict)parse_requirements)find_packages.srclightning_fabricrequirementsZfabricZFREEZE_REQUIREMENTS)namelocationreturnc                 C   sT   t | |}|s"J d|  d| t|}|jsDJ d|  d| |j| |S )NzFailed to load module z from zModuleSpec.loader is None for )r   r   loaderexec_module)r   r   specpy r   c/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/lightning_fabric/__setup__.py_load_py_module   s    
r   )r   c                  C   s   t jtdd} td| S )Nz.actionszassistant.py	assistant)ospathjoin_PROJECT_ROOTr   )r   r   r   r   _load_assistant   s    r   c                     s   t   tttrdndddd ttjtdD }  fdd| D }t|d	 D ]}t	|g||j
< qX|d	 |d
  |d< |d |d  |d< |S )Nnoneall)Zpath_dirunfreezec                 S   s   g | ]}t |qS r   r   .0pr   r   r   
<listcomp>'       z#_prepare_extras.<locals>.<listcomp>z*.txtc                    s0   i | ](}|j d vr|j jf d|j iqS ))zdocs.txtz	devel.txtzbase.txt	file_name)r   stemload_requirementsr"   r   Zcommon_argsr   r   
<dictcomp>(   s   
z#_prepare_extras.<locals>.<dictcomp>Z
strategiesZexamplestestdev)r   dict_PATH_REQUIREMENTS_FREEZE_REQUIREMENTSglobr   r   r   r	   strkey)Z	req_filesextrasreqr   r*   r   _prepare_extras    s    r6   c                  C   s   t  } tdtjtd}tdtjtd}| jt|j|jd}t	d|j|j
|j|j|jd|jtdd	d
gdddi|dddg dddg| jttrdnddt ddddg ddS )Naboutz__about__.pyversionz__version__.py)Zhomepager8   zlightning-fabricz)https://github.com/Lightning-AI/lightningr   r   zlightning_fabric.*)whereinclude ztext/markdownTF)zdeep learningZpytorchZAIz>=3.7wheelr   r    )r!   z0https://github.com/Lightning-AI/lightning/issuesz,https://pytorch-lightning.rtfd.io/en/latest/)zBug TrackerZDocumentationzSource Code)zEnvironment :: ConsolezNatural Language :: EnglishzDevelopment Status :: 4 - BetazIntended Audience :: Developersz:Topic :: Scientific/Engineering :: Artificial Intelligencez7Topic :: Scientific/Engineering :: Information Analysisz"Operating System :: OS Independentz#Programming Language :: Python :: 3z%Programming Language :: Python :: 3.7z%Programming Language :: Python :: 3.8z%Programming Language :: Python :: 3.9z&Programming Language :: Python :: 3.10)r   r8   descriptionauthorauthor_emailurldownload_urllicensepackagespackage_dirlong_descriptionZlong_description_content_typeZinclude_package_dataZzip_safekeywordsZpython_requiresZsetup_requiresZinstall_requiresZextras_requireproject_urlsclassifiers)r   r   r   r   r   _PACKAGE_ROOTZload_readme_descriptionZ__homepage__r8   r.   Z__docs__
__author____author_email____license__r
   r)   r/   r0   r6   )r   r7   r8   rE   r   r   r   _setup_args4   sD    
rM   ) r1   r   Zimportlib.utilr   r   pathlibr   typesr   typingr   r   pkg_resourcesr	   
setuptoolsr
   r   r   r   Z_SOURCE_ROOTrI   r/   boolintenvirongetr0   r2   r   r   r6   rM   r   r   r   r   <module>   s    	