
    {Kg{                        d Z ddlZddlZddlZddlmZ ddlmZ ddlZddl	Z	ddl
mZ ddlmZ  ee      Z ej                          D ]2  \  Z\  ZZej)                  d      D ]  Zee   j-                  e        4 dd	d
ZeD ]
  Zde ee<    d Z	 ddZej6                  j9                  dej!                               d        Zy)zCTests for the minimum dependencies in README.rst and pyproject.toml    N)defaultdict)Path)dependent_packages)parse_versionz, zbuild-system.requireszproject.dependencies)buildinstallzproject.optional-dependencies.c                     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	            n/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/sklearn/tests/test_min_dependencies_readme.pytest_min_dependencies_readmer)      s   
 %%'61FGjj	*G w''(//66K,K77>>+& 	;<			#	!DmmD)G&}}Q/q1AWGmmoG,,'0+,>w,G,JK+-T':S/TT-  
		s   9AE	%E	4E		Ec                    t        j                  d      }|g }t        |   }t        t        j
                        j                  j                  }|dz  }|j                         st        j                  d       |j                  d      5 }|j                  |      }d d d        | j                  d      }	}
|	D ]  }|
|   }
	 i }|
D ]G  }d|v r|j                  d      \  }}n'd|v r|j                  d      \  }}nt        | d      |||<   I t        |      t        |      k(  sJ |j                         D ]9  \  }}t        |      }t        t         |   d	         }||v r+||k(  r1J | d
        y # 1 sw Y   xY w)Ntomllibzpyproject.tomlz pyproject.toml is not available.rb.z>=z==zV not supported yet in this test. Only >= and == are supported for version requirementsr   r   )r   importorskip-min_depencies_tag_to_packages_without_versionr   r   r   r   r   r   r   loadsplitNotImplementedErrorsorteditemsr   r   )pyproject_sectionmin_dependencies_tagskip_version_check_forr+   expected_packagesroot_directorypyproject_toml_pathr"   pyproject_tomlpyproject_section_keysinfokeypyproject_build_min_versionsrequirementr%   r&   expected_min_versions                    r(   check_pyproject_sectionrB   F   s    !!),G%!#E '**+2299N(+;;%%' 	67		!	!$	'1 a 
( /44S9D%Cy & $& ;*006GW[ *006GW%-  H H 
 18$W-  ./6:K3LLLL8>>@(,-?-H-KL,,..U7);T0UU. A1 
(	's   E88Fz'min_dependencies_tag, pyproject_sectionc                 4    |dk(  rdgnd}t        | ||       y)zFCheck versions in pyproject.toml is consistent with _min_dependencies.r   numpyN)r7   )rB   )r5   r6   r7   s      r(   $test_min_dependencies_pyproject_tomlrE   |   s&     +?'*IgYt5    )N)__doc__r   r   r   collectionsr   pathlibr   r   r   sklearn._min_dependenciesr   sklearn.utils.fixesr   listr/   r4   r%   r'   extrasr1   extraappend)min_dependencies_tag_to_pyproject_sectiontagr)   rB   markparametrizerE    rF   r(   <module>rU      s    I 	  	 #    8 -0;D0A -&>&8&>&>&@"G"k6d#5e<CCGL $ 'A
 %%- ) 9C
(. .c2 9%UR EI3Vl --335			rF   