Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyo


t_c@@sddlmZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZddl
mZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZdd
lmZ ddl!m"Z#ddl$m%Z%ddl$m&Z'ddl(m)Z)ddl*m+Z+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAddlBmCZCddlDmEZEmFZFddlGmHZHddlImJZJddlKmLZLeHrddlMmNZNmOZOmPZPmQZQmRZRmSZSmTZTddlmUZUdd lVmWZWdd!lXmYZYdd"lZm[Z[nej\e]Z^d#Z_d$e`fd%YZad&ZbdS('i(tabsolute_importN(t
pkg_resourcestsix(tRequirement(tcanonicalize_name(tVersion(tparse(tPep517HookCaller(tNoOpBuildEnvironment(tInstallationError(t
get_scheme(tLink(tgenerate_metadata(tinstall_editable(tLegacyInstallFailure(tinstall(t
install_wheel(tload_pyproject_tomltmake_pyproject_path(tUninstallPathSet(t
deprecated(tdirect_url_from_link(tHashes(t
indent_log(
task_path_existst
backup_dirtdisplay_pathtdist_in_install_pathtdist_in_site_packagestdist_in_usersitetget_distributiontget_installed_versionthide_urltredact_auth_from_url(tget_metadata(t
TempDirectoryt
tempdir_kinds(tMYPY_CHECK_RUNNING(trunning_under_virtualenv(tvcs(tAnytDicttIterabletListtOptionaltSequencetUnion(tBuildEnvironment(tDistribution(tSpecifierSet(tMarkercC@s|jtj}tjj|\}}tj||}|jdrmtj}tjj	|d}n,tj
}tjj	|djdd}||d|d|S(sQReturn a pkg_resources.Distribution for the provided
    metadata directory.
    s	.egg-infoit-tproject_nametmetadata(trstriptostseptpathtsplitRtPathMetadatatendswithR0tsplitexttDistInfoDistribution(tmetadata_directorytdist_dirtbase_dirt
dist_dir_nameR5tdist_clst	dist_name((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt	_get_distEs		#tInstallRequirementcB@seZdZed!d!d!ed!d!d!ed"edZdZdZdZe	dZ
e	dZe	dZe	dZ
d!d	Ze	d
ZedZdZd
ZdZdZdZe	dZe	dZe	dZe	dZdZdZdZe	dZdZdZ eedZ!edZ"eedZ#dZ$dZ%d!d!d!d!eeed Z&RS(#s
    Represents something that may be installed later on, may have information
    about where to fetch the relevant requirement and also contains logic for
    installing the said requirement.
    cC@s||_||_||_||_d|_d|_|jrr|jrrtj	j
tj	j|j|_qrn|dkr|r|j
rt|j
}n||_|_t|_d|_|jr|jjr|jj|_n|r||_n+|rd|jD|_nt|_|dkrC|rC|j}n||_d|_t|_d|_d|_|r||ng|_|	r|	ng|_|
r|
ni|_t|_|
|_ t|_!||_"t#|_$d|_%d|_&g|_'d|_(||_)dS(NcS@sh|]}tj|qS((Rt
safe_extra(t.0textra((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pys	<setcomp>s	(*treqt
comes_fromt
constraintteditabletNonetlegacy_install_reasont
source_dirtis_fileR7R9tnormpathtabspatht	file_pathturlRtlinkt
original_linktFalsetoriginal_link_is_in_wheel_cachetlocal_file_pathtextrastsettmarkertmarkerstsatisfied_bytshould_reinstallt_temp_build_dirtinstall_succeededtinstall_optionstglobal_optionsthash_optionstpreparedt
user_suppliedtsuccessfully_downloadedtisolatedRt	build_envR?tpyproject_requirestrequirements_to_checktpep517_backendt
use_pep517(tselfRJRKRMRVR^RnRiRcRdReRLR[Rg((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt__init__gsT									!																cC@s|jrFt|j}|jrj|djt|jj7}qjn$|jrdt|jj}nd}|jdk	r|djt|jj	7}n|j
rt|j
tj
r|j
}n|j
j}|r|dj|7}qn|S(Ns from {}s<InstallRequirement>s in {}s
 (from {})(RJtstrRVtformatR!RUR_RNRtlocationRKt
isinstanceRtstring_typest	from_path(RotsRK((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt__str__s 		%	"	cC@s"dj|jjt||jS(Ns<{} object: {} editable={!r}>(Rrt	__class__t__name__RqRM(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt__repr__sc@sYt|t}fdt|D}djd|jjddj|S(s>An un-tested helper for getting state, for debugging.
        c3@s%|]}dj||VqdS(s{}={!r}N(Rr(RHtattr(t
attributes(sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pys	<genexpr>ss<{name} object: {{{state}}}>tnametstates, (tvarstsortedRrRyRztjoin(RotnamesR((R}sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytformat_debugs	cC@s/|jdkrdStjtj|jjS(N(RJRNRt
ensure_strRt	safe_nameR~(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyR~scC@s
|jjS(N(RJt	specifier(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyRscC@s:|j}t|dko9tt|jddhkS(sReturn whether I am pinned to an exact version.

        For example, some-package==1.2 is pinned; some-package>1.2 is not.
        is==s===(Rtlentnexttitertoperator(Rot
specifiers((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt	is_pinneds	cC@s
t|jS(N(RR~(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytinstalled_versionsc@s@|sd}njdk	r8tfd|DStSdS(Ntc3@s(|]}jji|d6VqdS(RIN(R^tevaluate(RHRI(Ro(sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pys	<genexpr>(s(R(R^RNtanytTrue(Rotextras_requested((RosN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt
match_markers s	cC@s
t|jS(sReturn whether any known-good hashes are specified as options.

        These activate --require-hashes mode; hashes specified as part of a
        URL do not.

        (tboolRe(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pythas_hash_options-s	cC@sb|jj}|r|jn|j}|rX|jrX|j|jgj|jnt|S(sReturn a hash-comparer that considers my option- and URL-based
        hashes to be known-good.

        Hashes in URLs--ones embedded in the requirements file, not ones
        downloaded from an index server--are almost peers with ones from
        flags. They satisfy --require-hashes (whether it was implicitly or
        explicitly activated) but do not activate it. md5 and sha224 are not
        allowed in flags, which should nudge people toward good algos. We
        always OR all hashes together, even ones from URLs.

        :param trust_internet: Whether to trust URL-based (#md5=...) hashes
            downloaded from the internet, as by populate_link()

        (	RetcopyRVRWthasht
setdefaultt	hash_nametappendR(Rottrust_internettgood_hashesRV((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pythashes8s
"cC@sy|jdkrdSt|j}|jrut|jtjrL|j}n|jj}|ru|d|7}qun|S(s@Format a nice indicator to show where this "comes from"
        s->N(RJRNRqRKRtRRuRv(RoRwRK((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyRvNs	c	C@s|jdk	r|jjS|jdkrMtdtjdt|_|jjSt|j	}|rdj
|tjj
}ntjj|stjd|tj|ntjj||}|rdnt}td|d|dtjdtjS(Ntkindtglobally_manageds{}_{}sCreating directory %sR9tdelete(RaRNR9RJR#R$t	REQ_BUILDRRR~Rrtuuidtuuid4thexR7texiststloggertdebugtmakedirsRRX(Rot	build_dirt
autodeletetparallel_buildstdir_nametactual_build_dirt
delete_arg((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytensure_build_location^s&

	cC@s^tt|jdtr%d}nd}tdj|jd||jdg|_dS(s3Set requirement after generating metadata.
        Rs==s===RtNameN(Rtt
parse_versionR5RRRRJ(Rotop((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt_set_requirements		
cC@s^t|jd}t|jj|kr/dStjd|j||jt||_dS(NRseGenerating metadata for package %s produced metadata for project name %s. Fix your #egg=%s fragments.(RR5RJR~RtwarningR(Rot
metadata_name((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytwarn_on_mismatching_namescC@s|jdkrdSt|jj}|s/dS|j}|jjj|dtsd|_|rt	|rzt|_
qtrt|rt
dj|j|jqqt|rt|_
qn'|jrt|_
d|_n	||_dS(sFind an installed distribution that satisfies or conflicts
        with this requirement, and set self.satisfied_by or
        self.should_reinstall appropriately.
        NtprereleasessVWill not install to the user site because it will lack sys.path precedence to {} in {}(RJRNRR~tparsed_versionRtcontainsRR_RR`R&RR	RrR4RsRRM(Rot
use_user_sitet
existing_disttexisting_version((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytcheck_if_existss,					cC@s|js
tS|jjS(N(RVRXtis_wheel(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyRs	cC@s+tjj|j|jr$|jjp'dS(NR(R7R9RRPRVtsubdirectory_fragment(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytunpacked_source_directorys	cC@sOtjj|jd}tjrKt|tjrK|jt	j
}n|S(Nssetup.py(R7R9RRRtPY2Rtt	text_typetencodetsystgetfilesystemencoding(Rotsetup_py((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt
setup_py_pathscC@s
t|jS(N(RR(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytpyproject_toml_pathscC@st|j|j|jt|}|dkr=t|_dSt|_|\}}}}||_||_	t
|j|d||_dS(sALoad the pyproject.toml file.

        After calling this routine, all of the attributes related to PEP 517
        processing for this requirement have been set. In particular, the
        use_pep517 attribute can be used to determine whether we should
        follow the PEP 517 or legacy (setup.py) code path.
        Ntbackend_path(
RRnRRRqRNRXRRlRkRRRm(Rotpyproject_toml_datatrequirestbackendtcheckR((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyRs					c
C@sh|jsOtd|jd|jd|jd|jd|jpKdj|jSt	d|jd|j
S(sKInvokes metadata generator functions, with the required arguments.
        RjRRPRitdetailssfrom {}R(Rntgenerate_metadata_legacyRjRRRiR~RrRVRRm(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt_generate_metadatas						cC@sMt|j|_WdQX|js5|jn
|j|jdS(sEnsure that project metadata is available.

        Under PEP 517, call the backend hook to prepare the metadata.
        Under legacy processing, call setup.py egg-info.
        N(RRR?R~RRtassert_source_matches_version(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytprepare_metadata"s	
	

cC@s.t|ds't|j|_n|jS(Nt	_metadata(thasattrR"tget_distR(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyR56scC@s
t|jS(N(RER?(Ro((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyR>scC@sd|jd}|jjrA||jjkrAtjd||ntjdt|j||dS(Ntversions'Requested %s, but installing version %ss;Source in %s has version %s, which satisfies requirement %s(R5RJRRRRRRP(RoR((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyRBs

cC@s4|jdkr0|j|d|d||_ndS(sAEnsure that a source_dir is set.

        This will create a temporary build dir if the name of the requirement
        isn't known yet.

        :param parent_dir: The ideal pip parent_dir for the source_dir.
            Generally src_dir for editables and build_dir for sdists.
        :return: self.source_dir
        RRN(RPRNR(Rot
parent_dirRR((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytensure_has_source_dirUs
cC@s|js tjd|jdS|jjdkr6dS|jjjdd\}}tj|}|r|jj	sdj
|jj}d}|jjjdrd}nt
||dd	d
dnt|jj}|r|j|jd|q|j|jd|ndS(
Ns>Cannot update repository at %s; repository location is unknowntfilet+is5This form of VCS requirement is being deprecated: {}.sgit+git@smgit+https://git@example.com/..., git+ssh://git@example.com/..., or the insecure git+git://git@example.com/...tgone_ins21.0tissueiRU(RVRRRPtschemeRUR:R'tget_backendtis_vcsRrRNt
startswithRR tobtaintexport(RoRtvc_typeRUtvcs_backendtreasontreplacementt
hidden_url((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytupdate_editablems,	
	cC@sbt|jj}|s/tjd|jdStjd|tj|}|j	|||S(s
        Uninstall the distribution currently satisfying this requirement.

        Prompts before removing or modifying files unless
        ``auto_confirm`` is True.

        Refuses to delete or modify files outside of ``sys.prefix`` -
        thus uninstallation within a virtual environment can only
        modify that virtual environment, even if the virtualenv is
        linked to global site-packages.

        s#Skipping %s as it is not installed.sFound existing installation: %sN(
RRJR~RRRNtinfoRt	from_disttremove(Rotauto_confirmtverbosetdisttuninstalled_pathset((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt	uninstallscC@s<d}tjj||}|||}|jd|S(NcS@s0|t|d}|jtjjd}|S(Nit/(RtreplaceR7R9R8(R~tprefix((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt_clean_zip_namesR(R7R9RR~(RoR9t	parentdirtrootdirRR~((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt_get_archive_names	
cC@sSt}dj|j|jd}tjj||}tjj|rtdjt	|d}|dkr|t
}q|dkrtjdt	|tj
|q|dkrt|}tjd	t	|t	|tj||q|dkrtjd
qn|s!dStj|dtjdt}|tjjtjj|j}xtj|D]\}	}
}xU|
D]M}|j|d
|	d|}
tj|
d}d|_|j|dqWxN|D]F}|j|d
|	d|}tjj|	|}|j||qWqwWWdQXtjdt	|dS(s}Saves archive to provided build_dir.

        Used for saving downloaded VCS requirements as part of `pip download`.
        s	{}-{}.zipRs8The file {} exists. (i)gnore, (w)ipe, (b)ackup, (a)bort titwtbtasDeleting %ssBacking up %s to %siNt
allowZip64RRRiiRsSaved %s(RRRRi( RRrR~R5R7R9RRRRRXRRRRtshutiltmoveRtexittzipfiletZipFiletZIP_DEFLATEDtnormcaseRSRtwalkRtZipInfot
external_attrtwritestrtwriteR(RoRtcreate_archivetarchive_nametarchive_pathtresponset	dest_filet
zip_outputtdirtdirpathtdirnamest	filenamestdirnametdir_arcnametzipdirtfilenametfile_arcname((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytarchivesT			
	
	
c	
C@sjt|jd|d|d|d|jd|}	|dk	rB|ng}|jrt||d|d|d|d|jd|jd|jd	|jd
|jt	|_
dS|jr0d}
|jrt
|j|j|j}
nt|j|jd|	dt|jd
|d|d|
d|jt	|_
dSt||j}t||j}yytd|d|d|d|d|d|d
|d|	d|jd|jd|jd	|jd
|jdt|j}WnHtk
r}t|_
tj|jntk
rt	|_
nX||_
|rf|jdkrft ddj!|jddddddndS(NtuserthometrootRiRRR~RRjRRtreq_descriptiont	pycompiletwarn_script_locationt
direct_urlt	requestedRcRdtreq_namei Rsg{} was installed using the legacy 'setup.py install' method, because a wheel could not be built for it.Rs+to fix the wheel build issue reported aboveRs21.0R("R
R~RiRNRMtinstall_editable_legacyRRjRRRbRRWRRPRYRRZRqRJRgtlistRdRctinstall_legacyRRXRtreraisetparentt	ExceptionRORRr(
RoRcRdRRRRRRRR tsuccesstexc((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyRs								
				
								
		N(('Rzt
__module__t__doc__RXRNRpRxR{RtpropertyR~RRRRRRRRvRRRRRRRRRRRR5RRRRRRRR(((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyRF`sde			
		&			%					,		@c	C@shd}|jsd}n$|jr*d}n|jr<d}n|rdtddddd	dd
dn|S(NRs3Unnamed requirements are not allowed as constraintss$Links are not allowed as constraintssConstraints cannot have extrasRsConstraints are only allowed to take the form of a package name and a version specifier. Other forms were originally permitted as an accident of the implementation, but were undocumented. The new implementation of the resolver no longer supports these forms.Rs,replacing the constraint with a requirement.RRi (R~RVR[RRN(RJtproblem((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pytcheck_invalid_constraint_typems						
(ct
__future__RtloggingR7RRRRtpip._vendorRRt"pip._vendor.packaging.requirementsRtpip._vendor.packaging.utilsRtpip._vendor.packaging.versionRRRtpip._vendor.pep517.wrappersRtpip._internal.build_envRtpip._internal.exceptionsR	tpip._internal.locationsR
tpip._internal.models.linkRt'pip._internal.operations.build.metadataRt.pip._internal.operations.build.metadata_legacyRt0pip._internal.operations.install.editable_legacyR
R#t'pip._internal.operations.install.legacyRRR%t&pip._internal.operations.install.wheelRtpip._internal.pyprojectRRtpip._internal.req.req_uninstallRtpip._internal.utils.deprecationRt&pip._internal.utils.direct_url_helpersRtpip._internal.utils.hashesRtpip._internal.utils.loggingRtpip._internal.utils.miscRRRRRRRRR R!tpip._internal.utils.packagingR"tpip._internal.utils.temp_dirR#R$tpip._internal.utils.typingR%tpip._internal.utils.virtualenvR&tpip._internal.vcsR'ttypingR(R)R*R+R,R-R.R/tpip._vendor.pkg_resourcesR0t pip._vendor.packaging.specifiersR1tpip._vendor.packaging.markersR2t	getLoggerRzRREtobjectRFR/(((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_install.pyt<module>s^F4	
Back to Directory File Manager