
    ϶vg[!                         d dl Z d dlZd dlZd dlZd dlZd dlZddlmZ d Zd Z	 G d d          Z
d Z ed	d
dddddddddddddddd          d             ZdS )    N   )Metadatac                 f    d                     d |                     d          D                       S )N
c              3      K   | ]A}|                                 |                                                     d           =|V  BdS )#N)strip
startswith).0lines     a/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/pkg_resources/tests/test_working_set.py	<genexpr>z!strip_comments.<locals>.<genexpr>   sd        ::<< !%

 7 7 < <         )joinsplit)ss    r   strip_commentsr      s>    99  GGDMM     r   c              #     K   |                                  } t          j        d|           D ]}|s|                    dd          }dt          |          cxk    rdk    sn J |                    d                              dd          \  }}|r9t          j        |                    d                    }t          d|f          }nd}t          j
        |||	          }|V  dS )
a  
    Parse a series of distribution specs of the form:
    {project_name}-{version}
       [optional, indented requirements specification]

    Example:

        foo-0.2
        bar-1.0
          foo>=3.0
          [feature]
          baz

    yield 2 distributions:
        - project_name=foo, version=0.2
        - project_name=bar, version=1.0,
          requires=['foo>=3.0', 'baz; extra=="feature"']
    z\n(?=[^\s])r   r      r   -zrequires.txtN)project_nameversionmetadata)r	   rer   lenpoprsplittextwrapdedentr   pkg_resourcesDistribution)r   specfieldsnamer   requiresr   dists           r   parse_distributionsr'      s     & 	
		A++   	D!$$CKK$$$$1$$$$$$

1,,S!44g 	vzz!}}55H :;;HHH)w
 
 
 



 r   c                       e Zd ZddZd ZdS )FakeInstallerreturnNc                     || _         d S N)_installable_dists)selfinstallable_distss     r   __init__zFakeInstaller.__init__;   s    "3r   c                 j    t          t          t          fd| j                            d           S )Nc                     | v S r,    )r&   reqs    r   <lambda>z(FakeInstaller.__call__.<locals>.<lambda>@   s    TS[ r   )nextiterfilterr-   )r.   r4   s    `r   __call__zFakeInstaller.__call__>   s9    0000$2IJJKKT
 
 	
r   )r*   N)__name__
__module____qualname__r0   r9   r3   r   r   r)   r)   :   s7        4 4 4 4
 
 
 
 
r   r)   c                  J   g }g }| D ]z}d t          j        |                                                              dd          D             \  }}}}}}	t	          t          |                    }t	          t          |                    }t	          t          j        |                    }|d|f|dz   d|	ffD ]\  }
}}|                    |
           t          |
                                          }t          j        d|          r-t          t          |          }t          |t                    sJ nt	          t          |                    }|                    t!          j        |||||                     Ɛ|t           j                            d||	          S )
Nc              3   X   K   | ]%}t          |                                          V  &d S r,   )r   lstrip)r   r   s     r   r   z7parametrize_test_working_set_resolve.<locals>.<genexpr>O   sF       
 
 188::&&
 
 
 
 
 
r   z

   F_replace_conflictingTz\w+$z^installed_dists,installable_dists,requirements,replace_conflicting,resolved_dists_or_exception)ids)r   r   r?   r   listr'   r    parse_requirementsappendr   r	   r   matchgetattr
issubclass	Exceptionpytestparammarkparametrize)	test_listidlist	argvaluestestr$   installed_distsr/   requirements	expected1	expected2id_replace_conflictingexpecteds                r   $parametrize_test_working_set_resolverY   D   s   FI " "
 
_T**113399&!DD
 
 
	

 2?CCDD !45F!G!GHHM<\JJKK5)$**D)<3
 	 	.C$h MM#%hnn&6&677Hx** ?"=(;;!(I666666 3H = =>>#% '    	( ;""	& 	 #   r   z
    # id
    noop

    # installed

    # installable

    # wanted

    # resolved

    # resolved [replace conflicting]
    z
    # id
    already_installed

    # installed
    foo-3.0

    # installable

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    foo-3.0

    # resolved [replace conflicting]
    foo-3.0
    z
    # id
    installable_not_installed

    # installed

    # installable
    foo-3.0
    foo-4.0

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    foo-3.0

    # resolved [replace conflicting]
    foo-3.0
    z
    # id
    not_installable

    # installed

    # installable

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    DistributionNotFound

    # resolved [replace conflicting]
    DistributionNotFound
    z
    # id
    no_matching_version

    # installed

    # installable
    foo-3.1

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    DistributionNotFound

    # resolved [replace conflicting]
    DistributionNotFound
    z
    # id
    installable_with_installed_conflict

    # installed
    foo-3.1

    # installable
    foo-3.5

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    foo-3.5
    z
    # id
    not_installable_with_installed_conflict

    # installed
    foo-3.1

    # installable

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    DistributionNotFound
    a  
    # id
    installed_with_installed_require

    # installed
    foo-3.9
    baz-0.1
        foo>=2.1,!=3.1,<4

    # installable

    # wanted
    baz

    # resolved
    foo-3.9
    baz-0.1

    # resolved [replace conflicting]
    foo-3.9
    baz-0.1
    a  
    # id
    installed_with_conflicting_installed_require

    # installed
    foo-5
    baz-0.1
        foo>=2.1,!=3.1,<4

    # installable

    # wanted
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    DistributionNotFound
    a  
    # id
    installed_with_installable_conflicting_require

    # installed
    foo-5
    baz-0.1
        foo>=2.1,!=3.1,<4

    # installable
    foo-2.9

    # wanted
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    baz-0.1
    foo-2.9
    a  
    # id
    installed_with_installable_require

    # installed
    baz-0.1
        foo>=2.1,!=3.1,<4

    # installable
    foo-3.9

    # wanted
    baz

    # resolved
    foo-3.9
    baz-0.1

    # resolved [replace conflicting]
    foo-3.9
    baz-0.1
    a  
    # id
    installable_with_installed_require

    # installed
    foo-3.9

    # installable
    baz-0.1
        foo>=2.1,!=3.1,<4

    # wanted
    baz

    # resolved
    foo-3.9
    baz-0.1

    # resolved [replace conflicting]
    foo-3.9
    baz-0.1
    a	  
    # id
    installable_with_installable_require

    # installed

    # installable
    foo-3.9
    baz-0.1
        foo>=2.1,!=3.1,<4

    # wanted
    baz

    # resolved
    foo-3.9
    baz-0.1

    # resolved [replace conflicting]
    foo-3.9
    baz-0.1
    a  
    # id
    installable_with_conflicting_installable_require

    # installed
    foo-5

    # installable
    foo-2.9
    baz-0.1
        foo>=2.1,!=3.1,<4

    # wanted
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    baz-0.1
    foo-2.9
    z
    # id
    conflicting_installables

    # installed

    # installable
    foo-2.9
    foo-5.0

    # wanted
    foo>=2.1,!=3.1,<4
    foo>=4

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    VersionConflict
    a+  
    # id
    installables_with_conflicting_requires

    # installed

    # installable
    foo-2.9
        dep==1.0
    baz-5.0
        dep==2.0
    dep-1.0
    dep-2.0

    # wanted
    foo
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    VersionConflict
    ap  
    # id
    installables_with_conflicting_nested_requires

    # installed

    # installable
    foo-2.9
        dep1
    dep1-1.0
        subdep<1.0
    baz-5.0
        dep2
    dep2-1.0
        subdep>1.0
    subdep-0.9
    subdep-1.1

    # wanted
    foo
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    VersionConflict
    z
    # id
    wanted_normalized_name_installed_canonical

    # installed
    foo.bar-3.6

    # installable

    # wanted
    foo-bar==3.6

    # resolved
    foo.bar-3.6

    # resolved [replace conflicting]
    foo.bar-3.6
    c                    t          j        g           }t          t          |j        |                      t          j        |j        |t          |          |          }t          j
        |          r9t          j        |          5   |             d d d            d S # 1 swxY w Y   d S t           |                      t          |          k    sJ d S )N)	installerrW   )r    
WorkingSetrC   mapadd	functoolspartialresolver)   inspectisclassrJ   raisessorted)rR   r/   rS   rW   resolved_dists_or_exceptionwsresolve_calls          r   test_working_set_resolveri   s   s#   l 
	!"	%	%BRV_	%	%&&&$

 122/	  L 233 M]677 	 	LNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 llnn%%0K)L)LLLLLLLs   	B!!B%(B%)r_   rb   r   r   rJ   r    test_resourcesr   r   r'   r)   rY   ri   r3   r   r   <module>rk      sF        				       $ $ $ $ $ $  " " "J
 
 
 
 
 
 
 
, , ,^ &%$&"$&$,(,,,,,(08y
n n^M M_n n^M M Mr   