
    h$,f                     `    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y)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                        j                  j                  }|dz  }t        j                  j                  |      st        j                  d       |j                  d      5 }|D ]  }| j                  |      }|s|j                  d      |j                  d      }}|j!                         }|t"        v sRt%        |      }t%        t"        |   d	         }||k(  rxJ | d
        	 d d d        y # 1 sw Y   y xY w)NPyPyz0PyPy does not always share the same minimum depszN(\.\. \|)(([A-Za-z]+\-?)+)(MinVersion\| replace::)( [0-9]+\.[0-9]+(\.[0-9]+)?)z
README.rstz%The README.rst file is not available.r      r    has a mismatched version)platformpython_implementationpytestskiprecompiler   sklearn__file__parentospathexistsopenmatchgrouplowerr   r   )	patternreadme_pathreadme_fileflinematchedpackageversionmin_versions	            Jlib/python3.12/site-packages/sklearn/tests/test_min_dependencies_readme.pytest_min_dependencies_readmer&      s3   
 %%'61FGjj	*G w''(//66K,K77>>+& 	;<			#	 U! 	UDmmD)G&}}Q/q1AWGmmoG,,'0+,>w,G,JK+-T':S/TT-	UU U Us   9AE	%E	4E		Ec                     t        j                  d      } t        t        j                        j
                  j
                  }|dz  }|j                         st        j                  d       |j                  d      5 }| j                  |      }ddd       d   d   }i }|D ]5  }d|v sd	|v r|j                  d      \  }}	|j                         }|	||<   7 t        d
dg      t        |      k(  sJ |j                         D ]4  \  }}	t        |	      }	t        t        |   d         }
|	|
k(  r,J | d        y# 1 sw Y   xY w)zFCheck versions in pyproject.toml is consistent with _min_dependencies.tomllibzpyproject.tomlz pyproject.toml is not available.rbNzbuild-systemrequiresz>=znumpy>=1.25scipycythonr   r   )r   importorskipr   r   r   r   r   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_tomlr9   8   si    !!),G'**+2299N(+;;%%' 	67		!	!$	' )1 a) (7
C#% ) <;+*006GWmmoG4;(1< "#s+G'HHHH8>>@ V(,-?-H-KL..U7);T0UU.	V') )s   >D??E)__doc__r   r   r   pathlibr   r   r   sklearn._min_dependenciesr   sklearn.utils.fixesr   r&   r9        r%   <module>r@      s/    I 
  	    8 -%UP$Vr?   