§
|<ˆj¬ ã óv — d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
d„ Zd„ Zd „ Z
G d
„ d¦ « ZdS )aF
This module represents the various types of requirement that can be specified for
a project. It is somewhat redundant to re-implement here as we could use
`pip.req.InstallRequirement`, but that would require depending on pip which is not
easy to do since it will usually be installed by the user at a specific version.
Additionally, the pip implementation has a lot of extra features that we don't need -
we don't expect relative file paths to exist, for example. Note that the parsing here
is also intentionally more lenient - it is not our job to validate the requirements
list.
é N)ÚPath)ÚOptional)Úparse)ÚRequirementc óR — t j j | v p| d¦ « S )Nú.)ÚosÚpathÚsepÚ
startswith)Úreqs ús/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/requirements_detector/requirement.pyÚ_is_filepathr s" € å
Œ7Œ;˜#ÐÐ4 §¢°Ñ!4Ô!4Ð4ó c ó^ — d| vrdS t j | ¦ « }d|vrdS |d d S )zs
>>> _parse_egg_name('egg=fish&cake=lala')
fish
>>> _parse_egg_name('something_spurious')
None
ú=NÚeggr )r Úparse_qs)Úurl_fragmentÚpartss r Ú_parse_egg_namer sA € ð �,ÐÐØˆtÝŒN˜<Ñ(Ô(€EØ�EÐÐØˆtØ�Œ<˜Œ?Ðr c ól — | j | j | j | j | j d f}t j |¦ « S ©N)ÚschemeÚnetlocr
ÚparamsÚqueryr Ú
urlunparse)ÚurlpartsÚnew_urlpartss r Ú_strip_fragmentr! ( s8 € àŒØŒØŒ
،،Øð
€Lõ Ô˜LÑ)Ô)Ð)r c óŽ — e Zd Z ddedededefd„Zdefd„Zdefd „Zd
„ Z d„ Z
d„ Zd
„ Zd„ Z
eddeded fd„¦ « ZdS )ÚDetectedRequirementNÚnameÚurlÚrequirementÚlocation_definedc ó² — |�1|j | _ || _ d„ |j D ¦ « | _ d | _ n|| _ g | _ || _ d | _ || _ d S )Nc ó* — g | ]}|j |j f‘ŒS © )ÚoperatorÚversion)Ú.0Úss r ú