U ʗRe@sddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZeeZGdddZdS) N)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlc@sreZdZdZddgZeeeeeddddZeeeedddd Z ed d d Z eeed ddZ dS) SearchScopezF Encapsulates the locations that pip is configured to search. find_links index_urls)r r returncCsg}|D]0}|dr.t|}tj|r.|}||qtsvt||D](}t j |}|j dkrLt dqvqL|||dS)zQ Create a SearchScope object after normalizing the `find_links`. ~httpszipip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.r r ) startswithrospathexistsappendr itertoolschainurllibparseurlparseschemeloggerwarning)clsr r built_find_linkslinknew_linkparsedr!/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/search_scope.pycreates&     zSearchScope.createNcCs||_||_dSNr)selfr r r!r!r"__init__AszSearchScope.__init__)r cCsg}g}|jrt|jtjgkrt|jD]:}t|}tj|}|jsR|jsRt d|| |q"| d d ||jr| d d dd|jDd |S)Nz:The index url "%s" seems invalid, please provide a scheme.zLooking in indexes: {}z, zLooking in links: {}css|]}t|VqdSr$)r.0urlr!r!r" hsz6SearchScope.get_formatted_locations.. )r r simple_urlrrrurlsplitrnetlocrrrformatjoinr )r%linesredacted_index_urlsr)redacted_index_urlpurlr!r!r"get_formatted_locationsIs,    z#SearchScope.get_formatted_locations) project_namer cs(ttdfdd fdd|jDS)zReturns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations )r)r cs.t|tjt}|ds*|d}|S)N/) posixpathr0rrquoterendswith)r)loc)r6r!r"mkurl_pypi_urlts z.mkurl_pypi_urlcsg|] }|qSr!r!r')r<r!r" sz8SearchScope.get_index_urls_locations..)strr )r%r6r!)r<r6r"get_index_urls_locationsms z$SearchScope.get_index_urls_locations) __name__ __module__ __qualname____doc__ __slots__ classmethodrr>r#r&r5r?r!r!r!r"rs) $r)rloggingrr8 urllib.parsertypingrpip._vendor.packaging.utilsrpip._internal.models.indexrpip._internal.utils.compatrpip._internal.utils.miscrr getLoggerr@rrr!r!r!r"s