(W%O] d dl Z d dlmZ d dlmZmZ d dlZddlmZm Z ddl mZ ddlm Z ddlmZ g d Zd Zeeef Zdedee fd Zdedee fdZdedee fdZdedee fdZdedee fdZdS ) N)Path)ListUnion )CouldNotParseRequirementsRequirementsNotFound) from_setup_py)parse_constraint)DetectedRequirement)find_requirementsfrom_requirements_txtfrom_requirements_dirfrom_requirements_blobfrom_pyproject_tomlr r r )z-iz--index-urlz--extra-index-urlz --no-indexz-fz--find-linksz-rpathreturnc g }t | t rt | } | dz }| rJ| r6 t | }| |S # t $ r Y nw xY w| dz }| r^| rJ t | }t | dk r| |S n# t $ r Y nw xY wdD ]M}| |z }|j r?| r+ |t | z }6# t $ r }Y d}~Ed}~ww xY wN| dz }| r*| rt | }|||z }t | } | || z }t t | }t | dk r| |S t )a This method tries to determine the requirements of a particular project by inspecting the possible places that they could be defined. It will attempt, in order: 1) to parse setup.py in the root for an install_requires value 2) to read a requirements.txt file or a requirements.pip in the root 3) to read all .txt files in a folder called 'requirements' in the root 4) to read files matching "*requirements*.txt" and "*reqs*.txt" in the root, excluding any starting or ending with 'test' If one of these succeeds, then a list of pkg_resources.Requirement's will be returned. If none can be found, then a RequirementsNotFound will be raised zsetup.pyzpyproject.tomlr )zrequirements.txtzrequirements.pipNrequirements) isinstancestrr existsis_filer sortr r lenr is_dirr r listsetr ) r r setup_pypoetry_tomlreqfile_namereqfileerequirements_dirfrom_dir from_blobs n/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/requirements_detector/detect.pyr r &