
    _nd                     b    d Z ddlZddlZddlZddlmZ ddlZddlZddlm	Z	 ddl
mZ d Zd ZdS )zCTests for the minimum dependencies in README.rst and pyproject.toml    N)Path)dependent_packages)parse_versionc                     t          j                    dk    rt          j        d           t	          j        d          } t          t          j        d                   j	        d         }|dz  }t          j                            |          st          j        d           |                    d          5 }|D ]}|                     |          }|s|                    d          |                    d	          }}|                                }|t"          v rBt%          |          }t%          t"          |         d                   }||k    sJ | d
            	 d d d            d S # 1 swxY w Y   d S )NPyPyz0PyPy does not always share the same minimum depszN(\.\. \|)(([A-Za-z]+\-?)+)(MinVersion\| replace::)( [0-9]+\.[0-9]+(\.[0-9]+)?)r   z
README.rstz%The README.rst file is not available.r       has a mismatched version)platformpython_implementationpytestskiprecompiler   sklearn__path__parentsospathexistsopenmatchgrouplowerr   r   )	patternreadme_pathreadme_fileflinematchedpackageversionmin_versions	            Jlib/python3.11/site-packages/sklearn/tests/test_min_dependencies_readme.pytest_min_dependencies_readmer&      s   
 %''611FGGGj	* G w'*++3A6K,K7>>+&& = 	;<<<			#		 U! 	U 	UDmmD))G &}}Q//q1A1AWGmmooG,,,'00+,>w,G,JKK+---'/T/T/T---	UU U U U U U U U U U U U U U U U U Us   7B'E,,E03E0c                     t          j        d          } t          t          j        d                   j        }|dz  }|                                st          j        d           |                    d          5 }| 	                    |          }ddd           n# 1 swxY w Y   |d         d         }i }|D ]7}d	|v r1|
                    d	          \  }}	|                                }|	||<   8t          d
dg          t          |          k    sJ |                                D ]G\  }}	t          |	          }	t          t          |         d                   }
|	|
k    sJ | d            HdS )zFCheck versions in pyproject.toml is consistent with _min_dependencies.tomllibr   zpyproject.tomlz pyproject.toml is not available.rbNzbuild-systemrequiresz>=scipycythonr   )r   importorskipr   r   r   parentr   r   r   loadsplitr   setitemsr   r   )r(   root_directorypyproject_toml_pathr   pyproject_tomlbuild_requirementspyproject_build_min_versionsrequirementr"   r#   expected_min_versions              r%   $test_min_dependencies_pyproject_tomlr:   7   s    !),,G'*1-..5N(+;;%%'' 8 	6777		!	!$	'	' )1 a) ) ) ) ) ) ) ) ) ) ) ) ) ) ) (7
C#% ) < <;*0066GWmmooG4;(1 "##s+G'H'HHHHH8>>@@ V V((,-?-H-KLL....70U0U0U....	V Vs   ;BB!$B!)__doc__r   r   r   pathlibr   r   r   sklearn._min_dependenciesr   sklearn.utils.fixesr   r&   r:        r%   <module>rA      s    I I 
			 				          8 8 8 8 8 8 - - - - - -%U %U %UP!V !V !V !V !Vr@   