a
    a>                  )   @   sV  d Z ddlZddlmZ ddlZddlmZmZm	Z	m
Z
mZ ddlmZ eeeZdZdZdZdZd	Zd
ZdZdZdZe	 rdndZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,d Z-d!Z.d"Z/d#Z0d$Z1d%Z2d&Z3d'Z4d(Z5d)Z6d*Z7d+Z8e	 r
dnd,Z9d-Z:d
Z;d.Z<d/Z=d0Z>d1Z?d2d2ed3eej@d4kd5d6d6ed7ed8d9d9ed:ed8d;d;ed<ed8d=d=ed>ed8d?d@edAed8dBdBedCed8dDdDedEed8dFdFedGed8dHdHedIed8dJdJedKed8dLdLedMe d8dNdNedOe!d8dPdPedQe"ejAdRkd5dSdSedTe#d8dUdUedVe$d8dWdWedXe%d8dYdYedZe&d8d[d[ed\e'd8d]d]ed^e(d8d_d`edae)d8dbdcedde*d8dedfedge+d8dhdiedje,ej@Bdkd5dldmedne-d8dodoedpe.d8dqdqedre/d8dsdsedte0d8duduedve1d8dwdwedxe2d8dydyedze3d8d{d{ed|e4d8d}d}ed~e5d8ddede6d8ddede7d8ddede8d8ddede9d8g%ZCeCddede:edddede;edddede<edddede=edddede>edddede?edg7 ZCG dd deDZEg aFdefddZGdd ZHtFejIfddZJdd ZKdd ZLdS )z+Module checking Spyder runtime dependencies    N)_DEV
is_pynsistrunning_in_cirunning_under_pytest)programsZ	mandatoryZoptionalzspyder pluginsz>=0.1.7z>=1.2.0z>=2.0.0z>=0.5.0z>=1.6.0z
>=20181111z>=3.0.2z>=7.6.0z>=0.17.2;<0.19.0z>=3.2.0z>=17.0.0z>=4.0z>=0.6.0z>=2.4.0z>=0.7.0;<0.9.0z>=4.4.0z>=0.4z>=5.3z>=2.0z>=2.5.0;<2.10.0z>=1.2.2;<1.3.0z>=1.0.0z>=0.4.0z>=0.26z>=17z=3.0.2z>=0.1.10z>=1.0.2z>=5.1.0z>=1.5.0z>=0.9.7z>=49.6.0z>=0.6.6z>=2.1.1;<2.2.0z>=4.2.0z>=0.1.1z>=0.10.3z>=0.21z>=1.7z>=1.1.1z>=0.17.0z>=0.7.3Zapplaunchservicesz.Notify macOS that Spyder can open Python filesdarwin)modnamepackage_namefeaturesrequired_versiondisplayZatomicwritesz Atomic file writes in the Editor)r	   r
   r   r   Zchardetz0Character encoding auto-detection for the EditorZcloudpicklez1Handle communications between kernel and frontendZcookiecutterz+Create projects from cookiecutter templatesZdiff_match_patchzdiff-match-patchz-Compute text file diff changes during editionZintervaltreez$Compute folding range nesting levelsZIPythonz&IPython interactive python environmentZjediz+Main backend for the Python Language ServerZ
jsonschemaz"Verify if snippets files are validZkeyringz:Save Github credentials to report internal errors securelyZ	nbconvertz*Manipulate Jupyter notebooks in the EditorZnumpydocz=Improve code completion for objects that use Numpy docstringsZparamikoz%Connect to remote kernels through SSHntZparsozAPython parser that supports error recovery and round-trip parsingZpexpectz,Stdio support for our language server clientZpicklesharez*Cache the list of installed Python modulesZpsutilz+CPU and memory usage info in the status barZpygmentsz9Syntax highlighting for a lot of file types in the EditorZpylintzStatic code analysisZpylspzpython-lsp-serverz*Code completion and linting for the EditorZpylsp_blackzpython-lsp-blackz<Autoformat Python files in the Editor with the Black packageZpyls_spyderzpyls-spyderz'Spyder plugin for the Python LSP ServerZxdgZpyxdgzParse desktop files on LinuxZlinuxZzmqZpyzmqz-Client for the language server protocol (LSP)Z
qdarkstylez#Dark style for the entire interfaceZ	qstylizerzCustomize Qt stylesheetsZ	qtawesomez9Icon theme based on FontAwesome and Material Design iconsZ	qtconsolez$Main package for the IPython consoleZqtpyz)Abstraction layer for Python Qt bindings.Zrtreez$Fast access to code snippets regionsZ
setuptoolszDetermine package versionZsphinxzDShow help for objects in the Editor and Consoles in a dedicated paneZspyder_kernelszspyder-kernelsz&Jupyter kernels for the Spyder consoleZtextdistancez!Compute distances between stringsZthree_mergezthree-mergez/3-way merge algorithm to merge document changesZwatchdogz)Watch file changes on project directoriesZcythonz'Run Cython files in the IPython Console)r	   r
   r   r   kindZ
matplotlibz%2D/3D plotting in the IPython consoleZnumpyzGView and edit two and three dimensional arrays in the Variable ExplorerZpandasz<View and edit DataFrames and Series in the Variable ExplorerZscipyz6Import Matlab workspace files in the Variable ExplorerZsympyz+Symbolic mathematics in the IPython Consolec                   @   s>   e Zd ZdZdZdZdefddZdd Zd	d
 Z	dd Z
dS )
DependencyzSpyder's dependency

    version may starts with =, >=, > or < to specify the exact requirement ;
    multiple conditions may be separated by ';' (e.g. '>=0.13;<1.0')OKNOKNc                 C   s\   || _ || _|| _|| _|| _|d u rRzt|| _W qX tyN   d | _Y qX0 n|| _d S )N)	r	   r
   r   r   r   r   Zget_module_versioninstalled_version	Exception)selfr	   r
   r   r   r   r    r   2lib/python3.9/site-packages/spyder/dependencies.py__init__)  s    zDependency.__init__c                 C   s   | j rt| j| j S dS dS )z Check if dependency is installedTN)r   r   Zis_module_installedr	   r   r   r   r   check<  s
    zDependency.checkc                 C   s,   |   rd| j| jf S d| j| jf S dS )!Return dependency status (string)z%s (%s)N)r   r   r   r   r   r   r   r   get_installed_versionD  s    z Dependency.get_installed_versionc                 C   s   |   r| jS | jS dS )r   N)r   r   r   r   r   r   r   
get_statusK  s    zDependency.get_status)__name__
__module____qualname____doc__r   r   	MANDATORYr   r   r   r   r   r   r   r   r      s   
r   c                 C   s<   t D ]}|j| krtd|  qt t| |||||g7 a dS )zAdd Spyder dependencyz*Dependency has already been registered: %sN)DEPENDENCIESr	   
ValueErrorr   )r	   r
   r   r   r   r   
dependencyr   r   r   addV  s    

r&   c                 C   s0   t D ]}|j| kr|   S qtd|  dS )z)Check if required dependency is installedzUnknown dependency %sN)r#   r	   r   RuntimeError)r	   r%   r   r   r   r   c  s    
r   c                 C   s   d}g }| D ]h}|j }|jdur.|d|j 7 }t|t|g}tdtdtdi}tttd}|||j ||	 g q|d7 }d	}d
}	t
|dd dD ]J\}
}}|
|	kr|dj|||
  d7 }|
}	|dj||||d7 }q|dks|dd }|S )z Return a status of dependencies.r   N 012)r)   r*   r+       z-1c                 S   s   | d | d    S )Nr   r,   )lower)xr   r   r   <lambda>      zstatus.<locals>.<lambda>)keyz{sep}# {name}:{sep})sepnamez{title}:  {version}{linesep})titleversionlinesep<br>)r	   r   maxlenr"   OPTIONALPLUGINappendr   r   sortedformat
capitalizeljust)depsr7   Zmaxwidthdatadepr5   Z	dep_orderZ	order_deptextZ
prev_orderorderr6   r   r   r   statusl  s6    

rH   c                  C   s   g } t D ]d}tst rPt sPtttd}t|d}t	|}|j
|v rPq|jtkr| s| | q| r~t| ddS dS dS )z2Return the status of missing dependencies (if any)z..zexternal-depsr8   )rC   r7   r-   N)r#   r   r   r   ospnormpathjoinHEREoslistdirr
   r   r<   r   r>   rH   )Zmissing_depsr%   Z	repo_pathZsubrepos_pathZsubreposr   r   r   missing_dependencies  s    

rO   c               
   C   sD   t D ]:} | ddrt| d | d | d | d | dtd qd S )	Nr   Tr	   r
   r   r   r   )r   )DESCRIPTIONSgetr&   r"   )rE   r   r   r   declare_dependencies  s    
rR   )Mr!   rM   os.pathpathrI   sysZspyder.config.baser   r   r   r   r   Zspyder.utilsr   dirnameabspath__file__rL   r"   r<   r=   ZAPPLAUNCHSERVICES_REQVERZATOMICWRITES_REQVERZCHARDET_REQVERZCLOUDPICKLE_REQVERZCOOKIECUTTER_REQVERZDIFF_MATCH_PATCH_REQVERZINTERVALTREE_REQVERZIPYTHON_REQVERZJEDI_REQVERZJSONSCHEMA_REQVERZKEYRING_REQVERZNBCONVERT_REQVERZNUMPYDOC_REQVERZPARAMIKO_REQVERZPARSO_REQVERZPEXPECT_REQVERZPICKLESHARE_REQVERZPSUTIL_REQVERZPYGMENTS_REQVERZPYLINT_REQVERZPYLSP_REQVERZPYLSP_BLACK_REQVERZPYLS_SPYDER_REQVERZPYXDG_REQVERZPYZMQ_REQVERZQDARKSTYLE_REQVERZQSTYLIZER_REQVERZQTAWESOME_REQVERZQTCONSOLE_REQVERZQTPY_REQVERZRTREE_REQVERZSETUPTOOLS_REQVERZSPHINX_REQVERZSPYDER_KERNELS_REQVERZTEXTDISTANCE_REQVERZTHREE_MERGE_REQVERZWATCHDOG_REQVERZCYTHON_REQVERZMATPLOTLIB_REQVERZNUMPY_REQVERZPANDAS_REQVERZSCIPY_REQVERZSYMPY_REQVERplatformr4   
startswithrP   objectr   r#   r&   r   r7   rH   rO   rR   r   r   r   r   <module>   sB  
   %3
	%