3 Re@sddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZmZddlmZer|ddlmZejeZGd d d eZdS) N)canonicalize_name)parse)PyPI)has_tls)normalize_pathredact_auth_from_url)MYPY_CHECK_RUNNING)Listc@s<eZdZdZddgZeddZddZdd Zd d Z d S) SearchScopezF Encapsulates the locations that pip is configured to search. find_links index_urlscCsg}x8|D]0}|jdr0t|}tjj|r0|}|j|q Wtszx4tj||D]$}t j |}|j dkrRt j dPqRW|||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 itertoolschain urllib_parseurlparseschemeloggerwarning)clsr r built_find_linkslinknew_linkparsedr /builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/models/search_scope.pycreates"     zSearchScope.createcCs||_||_dS)N)r r )selfr r r r r!__init__FszSearchScope.__init__cCsg}g}|jrz|jtjgkrzxF|jD]<}t|}tj|}|j rV|j rVtj d||j |q$W|j dj dj ||j r|j dj dj dd|j Ddj |S)Nz:The index url "%s" seems invalid, please provide a scheme.zLooking in indexes: {}z, zLooking in links: {}css|]}t|VqdS)N)r).0urlr r r! msz6SearchScope.get_formatted_locations.. )r r simple_urlrrurlsplitrnetlocrrrformatjoinr )r#linesredacted_index_urlsr&redacted_index_urlpurlr r r!get_formatted_locationsOs$  z#SearchScope.get_formatted_locationscs fddfdd|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 cs,tj|tjt}|jds(|d}|S)N/) posixpathr-rquoterendswith)r&loc) project_namer r!mkurl_pypi_urlys  z.mkurl_pypi_urlcsg|] }|qSr r )r%r&)r9r r! sz8SearchScope.get_index_urls_locations..)r )r#r8r )r9r8r!get_index_urls_locationsqs z$SearchScope.get_index_urls_locationsN) __name__ __module__ __qualname____doc__ __slots__ classmethodr"r$r2r;r r r r!r s  ) "r )rloggingrr4Zpip._vendor.packaging.utilsrZpip._vendor.six.moves.urllibrrpip._internal.models.indexrpip._internal.utils.compatrpip._internal.utils.miscrrpip._internal.utils.typingrtypingr getLoggerr<robjectr r r r r!s