관리-도구
편집 파일: detect.cpython-311.pyc
� �܋f� � � � d dl Z d dlmZ d dlmZmZ d dlZddlmZm Z ddl mZ ddlm Z ddlmZ g d �Zd Zeeef Zdedee fd �Zdedee fd�Zdedee fd�Zdedee fd�Zdedee fd�ZdS )� N)�Path)�List�Union� )�CouldNotParseRequirements�RequirementsNotFound)� from_setup_py)�parse_constraint)�DetectedRequirement)�find_requirements�from_requirements_txt�from_requirements_dir�from_requirements_blob�from_pyproject_tomlr r r )z-iz--index-urlz--extra-index-urlz --no-indexz-fz--find-linksz-r�path�returnc �� � 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 w�N| 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.pipN�requirements)� isinstance�strr �exists�is_filer �sortr r �lenr �is_dirr r �list�setr ) r r �setup_py�poetry_toml�reqfile_name�reqfile�e�requirements_dir�from_dir� from_blobs �m/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/requirements_detector/detect.pyr r &