o
    5‘ðiÁ  ã                   @   sh   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 dd„ Zd	d
„ Zdd„ Zdd„ ZdS )é    )ÚcleandocN)Úpath)Úapply_configuration)ÚDistribution)ÚSetuptoolsWarningc                 C   sD   dt dƒdœ}tj|| d� tƒ }t|| d ƒ}|jdgks J ‚d S )Nzsix
  # comment
a]  
            [project]
            name = "myproj"
            version = "1.0"
            dynamic = ["dependencies"]

            [build-system]
            requires = ["setuptools", "wheel"]
            build-backend = "setuptools.build_meta"

            [tool.setuptools.dynamic.dependencies]
            file = ["requirements.txt"]
            )zrequirements.txtúpyproject.toml©Úprefixr   Úsix)r   r   Úbuildr   r   Úinstall_requires©Útmp_pathÚfilesÚdist© r   úv/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/tests/config/test_pyprojecttoml_dynamic_deps.pyÚtest_dynamic_dependencies   s   ÿþr   c                 C   sH   dt dƒdœ}tj|| d� tƒ }t|| d ƒ}|jddgiks"J ‚d S )Nzsphinx
  # comment
ay  
            [project]
            name = "myproj"
            version = "1.0"
            dynamic = ["optional-dependencies"]

            [tool.setuptools.dynamic.optional-dependencies.docs]
            file = ["requirements-docs.txt"]

            [build-system]
            requires = ["setuptools", "wheel"]
            build-backend = "setuptools.build_meta"
            )zrequirements-docs.txtr   r   r   ÚdocsÚsphinx)r   r   r   r   r   Úextras_requirer   r   r   r   Ú"test_dynamic_optional_dependencies$   s   ÿþr   c                 C   sd   dt dƒdœ}tj|| d� | d }tjtdd�� ttƒ |ƒ W d  ƒ dS 1 s+w   Y  dS )	zµ
    Test that if PEP 621 was loosened to allow mixing of dynamic and static
    configurations in the case of fields containing sub-fields (groups),
    things would work out.
    zpillow~=42.0
  # comment
aI  
            [project]
            name = "myproj"
            version = "1.0"
            dynamic = ["optional-dependencies"]

            [project.optional-dependencies]
            docs = ["sphinx"]

            [tool.setuptools.dynamic.optional-dependencies.images]
            file = ["requirements-images.txt"]
            )zrequirements-images.txtr   r   r   zproject.optional-dependencies©ÚmatchN)r   r   r   ÚpytestÚraisesÚ
ValueErrorr   r   )r   r   Ú	pyprojectr   r   r   Ú(test_mixed_dynamic_optional_dependencies=   s   ÿþ"ÿr   c                 C   s„   dt dƒi}tj|| d� | d }tdddgiiƒ}tjtdd�� t||ƒ}W d   ƒ n1 s1w   Y  |jd	d
giks@J ‚d S )Nr   z�
            [project]
            name = "myproj"
            version = "1.0"
            optional-dependencies.docs = ["sphinx"]
            r   r   ÚhelloÚworldz.extras_require. overwrittenr   r   r   )	r   r   r   r   r   Úwarnsr   r   r   )r   r   r   r   r   r   r   Ú/test_mixed_extras_require_optional_dependencies[   s   ÿÿÿr"   )Úinspectr   r   Újaracor   Úsetuptools.config.pyprojecttomlr   Úsetuptools.distr   Úsetuptools.warningsr   r   r   r   r"   r   r   r   r   Ú<module>   s    