3 ”Re˜ã@sdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z mZddlmZddlmZdd lmZdd lmZmZdd lmZerØdd lmZdd lmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%ej&e'ƒZ(Gdd„dƒZ)Gdd„de*ƒZ+Gdd„de+ƒZ,dS)z;Build Environment used for isolation during sdist building éN)Ú OrderedDict)Úget_python_lib)Ú get_paths)Ú RequirementÚVersionConflictÚ WorkingSet)Ú__file__)Ú open_spinner)Úcall_subprocess)Ú TempDirectoryÚ tempdir_kinds)ÚMYPY_CHECK_RUNNING)Ú TracebackType)ÚTupleÚSetÚIterableÚOptionalÚListÚType)Ú PackageFinderc@seZdZdd„ZdS)Ú_PrefixcCsj||_d|_ttjdkrdnd||dœd�d|_td|d�}td|d�}||kr\|g|_n ||g|_dS) NFÚntÚ posix_prefix)ÚbaseÚplatbase)ÚvarsÚscripts)Ú plat_specificÚprefixT)ÚpathÚsetuprÚosÚnameÚbin_dirrÚlib_dirs)ÚselfrÚpurelibÚplatlib©r(ú†/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/build_env.pyÚ__init__s    z_Prefix.__init__N)Ú__name__Ú __module__Ú __qualname__r*r(r(r(r)rsrc@s8eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd S) ÚBuildEnvironmentzFCreates and manages an isolated environment to install build deps c söttjdd�‰t‡fdd„dDƒƒ|_g|_g|_x6tt|jj ƒƒƒD] }|jj |j ƒ|jj |j ƒqFWdd„td d �tdd �fDƒ}tjjˆjd ƒ|_tjj|jƒs´tj|jƒttjj|jd ƒd ƒ�"}|jtjdƒj||jd�ƒWdQRXdS)NT)ÚkindÚglobally_managedc3s&|]}|ttjjˆj|ƒƒfVqdS)N)rr!rÚjoin)Ú.0r")Útemp_dirr(r)ú ;sz,BuildEnvironment.__init__..ÚnormalÚoverlaycSsh|]}tjj|ƒ’qSr()r!rÚnormcase)r2Úsiter(r(r)ú Hsz,BuildEnvironment.__init__..F)rr8zsitecustomize.pyÚwaŸ import os, site, sys # First, drop system-sites related paths. original_sys_path = sys.path[:] known_paths = set() for path in {system_sites!r}: site.addsitedir(path, known_paths=known_paths) system_paths = set( os.path.normcase(path) for path in sys.path[len(original_sys_path):] ) original_sys_path = [ path for path in original_sys_path if os.path.normcase(path) not in system_paths ] sys.path = original_sys_path # Second, add lib directories. # ensuring .pth file are processed. for path in {lib_dirs!r}: assert not path in sys.path site.addsitedir(path) )Ú system_sitesr$)r5r6)r r Ú BUILD_ENVrÚ _prefixesÚ _bin_dirsÚ _lib_dirsÚreversedÚlistÚvaluesÚappendr#Úextendr$rr!rr1Ú _site_dirÚexistsÚmkdirÚopenÚwriteÚtextwrapÚdedentÚformat)r%rr;Úfpr()r3r)r*4s(    zBuildEnvironment.__init__cCsndd„dDƒ|_|jdd…}|jd}|r>|j|jtjƒƒ|jg}tjjtjj |ƒdtjj |ƒdœƒdS) NcSsi|]}tjj|dƒ|“qS)N)r!ÚenvironÚget)r2r"r(r(r)ú osz.BuildEnvironment.__enter__..ÚPATHÚPYTHONNOUSERSITEÚ PYTHONPATHÚ1)rQrRrS)rQrRrS) Ú _save_envr>rDÚsplitr!ÚpathseprErNÚupdater1)r%rÚold_pathÚ pythonpathr(r(r)Ú __enter__ms   zBuildEnvironment.__enter__cCs>x8|jjƒD]*\}}|dkr,tjj|dƒq |tj|<q WdS)N)rUÚitemsr!rNÚpop)r%Úexc_typeÚexc_valÚexc_tbÚvarnameÚ old_valuer(r(r)Ú__exit__�szBuildEnvironment.__exit__cCsœtƒ}tƒ}|r”t|jƒ}xx|D]p}y"|jtj|ƒƒdkrD|j|ƒWq tk rŽ}z,|jt|j dj ƒƒt|j dƒfƒWYdd}~Xq Xq W||fS)z–Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs Nré) Úsetrr?ÚfindrÚparseÚaddrÚstrÚargsÚas_requirement)r%ÚreqsÚmissingÚ conflictingÚwsÚreqÚer(r(r)Úcheck_requirementsŽs  (z#BuildEnvironment.check_requirementsc Cs†|j|}|j st‚d|_|s$dStjtjjtƒdddd|jdg}t j ƒt j kr\|j dƒxBdD]:}t|j|ƒ}|jd |jd d ƒd jt|p’dhƒƒfƒqbW|j} | râ|jd| dgƒx.| dd…D]} |jd| gƒqÊWn |j dƒx|jD]} |jd| gƒqôWx|jD]} |jd| gƒ�qW|j�r<|j dƒ|j�rN|j dƒ|j d ƒ|j|ƒt|ƒ�} t|| d�WdQRXdS)NTÚinstallz--ignore-installedz --no-userz--prefixz--no-warn-script-locationz-vÚ no_binaryÚ only_binaryz--Ú_ú-ú,z:none:z-irrdz--extra-index-urlz --no-indexz --find-linksz--trusted-hostz--prez--prefer-binary)Úspinner)rtru)r=r ÚAssertionErrorÚsysÚ executabler!rÚdirnameÚ pip_locationÚloggerÚgetEffectiveLevelÚloggingÚDEBUGrCÚgetattrÚformat_controlrDÚreplacer1ÚsortedÚ index_urlsÚ find_linksÚ trusted_hostsÚallow_all_prereleasesÚ prefer_binaryr r )r%ÚfinderÚ requirementsÚprefix_as_stringÚmessagerrjr„Úformatsr‡Ú extra_indexÚlinkÚhostryr(r(r)Úinstall_requirements¡s@              z%BuildEnvironment.install_requirementsN) r+r,r-Ú__doc__r*r[rcrrr”r(r(r(r)r.0s 9 r.c@s8eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd S) ÚNoOpBuildEnvironmentz5A no-op drop-in replacement for BuildEnvironment cCsdS)Nr()r%r(r(r)r*ÔszNoOpBuildEnvironment.__init__cCsdS)Nr()r%r(r(r)r[ØszNoOpBuildEnvironment.__enter__cCsdS)Nr()r%r^r_r`r(r(r)rcÜszNoOpBuildEnvironment.__exit__cCsdS)Nr()r%r(r(r)ÚcleanupåszNoOpBuildEnvironment.cleanupcCs tƒ‚dS)N)ÚNotImplementedError)r%rŒr�rŽr�r(r(r)r”ész)NoOpBuildEnvironment.install_requirementsN) r+r,r-r•r*r[rcr—r”r(r(r(r)r–Ðs  r–)-r•r�r!r{rJÚ collectionsrÚdistutils.sysconfigrÚ sysconfigrZpip._vendor.pkg_resourcesrrrÚpiprr~Úpip._internal.cli.spinnersr Úpip._internal.utils.subprocessr Úpip._internal.utils.temp_dirr r Úpip._internal.utils.typingr ÚtypesrÚtypingrrrrrrÚ"pip._internal.index.package_finderrÚ getLoggerr+rrÚobjectr.r–r(r(r(r)Ús,           !