Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/__pycache__/build_env.cpython-35.pyc



t_@s~dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZdd	lmZdd
lmZmZddlmZer,ddlmZdd
lmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%ej&e'Z(GdddZ)Gddde*Z+Gddde+Z,dS)z;Build Environment used for isolation during sdist building
N)OrderedDict)get_python_lib)	get_paths)RequirementVersionConflict
WorkingSet)__file__)open_spinner)call_subprocess)
TempDirectory
tempdir_kinds)MYPY_CHECK_RUNNING)
TracebackType)TupleSetIterableOptionalListType)
PackageFinderc@seZdZddZdS)_PrefixcCs||_d|_ttjdkr*dnddd|d|id|_tddd	|}tdd
d	|}||kr|g|_n||g|_dS)NFntposix_prefixvarsbaseplatbasescripts
plat_specificprefixT)pathsetuprosnamebin_dirrlib_dirs)selfrpurelibplatlibr(/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-1.el7.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/build_env.py__init__s		
z_Prefix.__init__N)__name__
__module____qualname__r*r(r(r(r)rsrc@sReZdZdZddZddZddZdd	Zd
dZdS)
BuildEnvironmentzFCreates and manages an isolated environment to install build deps
    c
s]tdtjddtfdddD|_g|_g|_xItt|jj	D],}|jj
|j|jj|j
qhWdd	td
dtd
dfD}tjjjd|_tjj|jstj|jttjj|jd
d2}|jtjdjd|d|jWdQRXdS)Nkindglobally_managedTc3s3|])}|ttjjj|fVqdS)N)rr!rjoin).0r")temp_dirr(r)	<genexpr>;sz,BuildEnvironment.__init__.<locals>.<genexpr>normaloverlaycSs"h|]}tjj|qSr()r!rnormcase)r2siter(r(r)	<setcomp>Hs	z,BuildEnvironment.__init__.<locals>.<setcomp>rFr8zsitecustomize.pywa
                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)rr	BUILD_ENVr	_prefixes	_bin_dirs	_lib_dirsreversedlistvaluesappendr#extendr$rr!rr1	_site_direxistsmkdiropenwritetextwrapdedentformat)r%rr;fpr()r3r)r*4s(		"	$zBuildEnvironment.__init__cCsdddD|_|jdd}|jd}|rU|j|jtj|jg}tjjdtjj	|dddtjj	|idS)NcSs(i|]}tjj|d|qS)N)r!environget)r2r"r(r(r)
<dictcomp>os	z.BuildEnvironment.__enter__.<locals>.<dictcomp>PATHPYTHONNOUSERSITE
PYTHONPATH1)rQrRrS)
	_save_envr>rDsplitr!pathseprErNupdater1)r%rold_path
pythonpathr(r(r)	__enter__ms	

	zBuildEnvironment.__enter__cCsSxL|jjD];\}}|dkr>tjj|dq|tj|<qWdS)N)rUitemsr!rNpop)r%exc_typeexc_valexc_tbvarname	old_valuer(r(r)__exit__szBuildEnvironment.__exit__cCst}t}|rt|j}x|D]}y/|jtj|dkrb|j|Wq.tk
r}z8|jt|j	dj
t|j	dfWYdd}~Xq.Xq.W||fS)zReturn 2 sets:
            - conflicting requirements: set of (installed, wanted) reqs tuples
            - missing requirements: set of reqs
        Nr)setrr?findrparseaddrstrargsas_requirement)r%reqsmissingconflictingwsreqer(r(r)check_requirementss		
.z#BuildEnvironment.check_requirementscCs|j|}|jstd|_|s0dStjtjjtdddd|jdg}t	j
tjkr|j
dx[dD]S}t|j|}|jd
|jddd
jt|pdhfqW|j}	|	r7|jd|	dgx;|	ddD]}
|jd|
gqWn
|j
dx$|jD]}|jd|gqNWx$|jD]}|jd|gquW|jr|j
d|jr|j
d|j
d
|j|t|}
t|d|
WdQRXdS)NTinstallz--ignore-installedz	--no-userz--prefixz--no-warn-script-locationz-v	no_binaryonly_binaryz--_-,z:none:z-irrdz--extra-index-urlz
--no-indexz--find-linksz--trusted-hostz--prez--prefer-binaryspinner)rtru)r=r AssertionErrorsys
executabler!rdirnamepip_locationloggergetEffectiveLevelloggingDEBUGrCgetattrformat_controlrDreplacer1sorted
index_urls
find_links
trusted_hostsallow_all_prereleases
prefer_binaryr	r
)r%finderrequirementsprefix_as_stringmessagerrjrformatsrextra_indexlinkhostryr(r(r)install_requirementss@
		

&	
	
	


z%BuildEnvironment.install_requirementsN)	r+r,r-__doc__r*r[rcrrrr(r(r(r)r.0s9
r.c@sReZdZdZddZddZddZdd	Zd
dZd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)rcszNoOpBuildEnvironment.__exit__cCsdS)Nr()r%r(r(r)cleanupszNoOpBuildEnvironment.cleanupcCs
tdS)N)NotImplementedError)r%rrrrr(r(r)rsz)NoOpBuildEnvironment.install_requirementsN)	r+r,r-rr*r[rcrrr(r(r(r)rs	r)-rrr!r{rJcollectionsrdistutils.sysconfigr	sysconfigrZpip._vendor.pkg_resourcesrrrpiprr~pip._internal.cli.spinnersr	pip._internal.utils.subprocessr
pip._internal.utils.temp_dirrrpip._internal.utils.typingr
typesrtypingrrrrrr"pip._internal.index.package_finderr	getLoggerr+rrobjectr.rr(r(r(r)<module>s*.
Back to Directory File Manager