U n an@sdZddlmZddlZddlZddlZddlZddlmZddl m Z ddl m Z m Z mZddlmZddlmZdd lmZdd lmZmZdd lmZdd lmZdd lmZddlmZddlm Z e r ddl!m"Z"m#Z#m$Z$m%Z%m&Z&ddl m'Z'm(Z(ddl)m*Z*e+e,Z-ddZ.ddZ/dddZ0dddZ1ddZ2Gddde Z3e e d d!d"d"d#d$Z4e e d%d&d'dd(d)Z5e e d*d+d,d'de d)Z6e e d-d.d/d0dd1d)Z7e e d2d3d'dd4d)Z8e e d5d6d7d'd8d$Z9e e d9d:d;d0ddd?e;e<d@dAdB=e<dCdDZ>e e3dEdFdGdHdIdIdJdKZ?e e dLdMd'de d)Z@e e dNdOdPdQdRdSZAe e dTdUdVdWdXdSZBe e dYdZd[d\d]d^d_d`ZCdadbZDe e3dcdddIdIdedfZEe e3dgdhdIddIdidjZFe e dkdldmdndoejGdpdqZHdrdsZIe e dtdud'ddvd)ZJdwdxZKdydzZLd{d|ZMd}d~ZNddZOddZPe e3ddddddIdedePdd ZQddZRddZSddZTddZUddZVe e ddddddqZWddZXddZYe e ddddeYdPdedd ZZe e ddddddqZ[e e ddddddqZ\ddZ]ddZ^ddZ_e e3ddeddIddZ`ddZae e dddeaddZbe e dddd'ddd)ZcddZde e3ddddddIddeddd Zee e ddd'dd$Zfe e dddddd)Zgdd̄Zhe e ddd'ddd)Zie e dddehde dэZje e dddddd׍Zke e dddddd׍Zle e dd'dddݍZme e dd'dddݍZne e ddd'ddd)Zoe e dddd'e d$ZpddZqe e dddeqdddZre e ddd'ddd)Zse e3ddIdIdddZtddZue e ddd'ddd)Zve e ddddgdge dZwde4e5e6e7e9e:e?e@eAeBeCeDeLeEeFe`ebeoe8evewgdZxdeHeIeJeKgdZydS(aC shared options and groups The principle here is to define options once, but *not* instantiate them globally. One reason being that options with action='append' can carry state between parses. pip parses general options twice internally, and shouldn't pass on state. To be consistent, all options will follow this design. )absolute_importN) strtobool)partial) SUPPRESS_HELPOption OptionGroup)dedent) BAR_TYPES) CommandError)USER_CACHE_DIRget_src_prefix) FormatControl)PyPI) TargetPython) STRONG_HASHES)MYPY_CHECK_RUNNING)AnyCallableDictOptionalTuple) OptionParserValues)ConfigOptionParsercCs.d||}td|}||dS)z Raise an option parsing error using parser.error(). Args: parser: an OptionParser instance. option: an Option instance. msg: the error text. z {} error: {} N)formattextwrapfilljoinspliterror)parseroptionmsgr$]C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\cli\cmdoptions.pyraise_option_error)s r&cCs,t||d}|dD]}||q|S)z Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser nameoptions)r add_option)groupr! option_groupr"r$r$r%make_option_group8s r,csPdkr |fdd}dddg}tt||rL|j}|tjddd dS) zDisable wheels if per-setup.py call options are set. :param options: The OptionParser options to update. :param check_options: The options to check, if not supplied defaults to options. Ncs t|dSN)getattr)n check_optionsr$r%getnamePsz+check_install_build_global..getname build_optionsglobal_optionsinstall_optionszbDisabling all use of wheels due to the use of --build-option / --global-option / --install-option.) stacklevel)anymapformat_controldisallow_binarieswarningswarn)r(r1r2namescontrolr$r0r%check_install_build_globalEs  r@FcCsbt|j|j|j|jg}ttdh}|j|ko6|j }|rH|rHt d|r^|r^|j s^t ddS)zFunction for determining if custom platform options are allowed. :param options: The OptionParser options. :param check_target: Whether or not to check if --target is being used. z:all:zWhen restricting platform and interpreter constraints using --python-version, --platform, --abi, or --implementation, either --no-deps must be set, or --only-binary=:all: must be set and --no-binary must not be set (or must be set to :none:).zQCan not use any platform or abi specific options unless installing via '--target'N) r8python_versionplatformabiimplementationr setr:ignore_dependenciesr target_dir)r( check_targetdist_restriction_set binary_onlysdist_dependencies_allowedr$r$r%check_dist_restriction]s&  rLcCs tj|Sr-)ospath expanduser)r"optvaluer$r$r%_path_option_checksrRc@s(eZdZejdZejZeed<dS) PipOption)rNrNN)__name__ __module__ __qualname__rTYPES TYPE_CHECKERcopyrRr$r$r$r%rSs  rSz-hz--helphelpz Show help.)destactionrZz --isolated isolated_mode store_truezSRun pip in an isolated mode, ignoring environment variables and user configuration.r[r\defaultrZz--require-virtualenvz--require-venv require_venvz-vz --verboseverbosecountzDGive more output. Option is additive, and can be used up to 3 times.z --no-colorno_colorzSuppress colored outputz-Vz --versionversionzShow version and exit.z-qz--quietquietzGive less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).z--progress-bar progress_barchoiceonz*Specify type of progress to be displayed [|z] (default: %default))r[typechoicesr`rZz--logz --log-filez --local-loglogrNz Path to a verbose appending log.)r[metavarrkrZz --no-inputno_inputz--proxyproxystrz/src". The default for global installs is "/src".)r[rkrnr`r\rrZcCs t||jS)zGet a format_control object.)r.r[)rr"r$r$r%_get_format_controlsrcCs"t|j|}t||j|jdSr-)rrr handle_mutual_excludes no_binary only_binaryr"rrQr!existingr$r$r%_handle_no_binarys  rcCs"t|j|}t||j|jdSr-)rrr rrrrr$r$r%_handle_only_binarys  rc Cs$ttt}tdddtd|ddS)Nz --no-binaryr:rrqavDo not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all binary packages, ":none:" to empty the set (notice the colons), or one or more package names with commas between them (no colons). Note that some packages are tricky to compile and may fail to install when this option is used on them.r[r\rrkr`rZ)r rErrr:r$r$r%rsrc Cs$ttt}tdddtd|ddS)Nz --only-binaryr:rrqaKDo not use source packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all source packages, ":none:" to empty the set, or one or more package names with commas between them. Packages without binary distributions will fail to install when this option is used on them.r)r rErrrr$r$r%rsrz --platformrBz[Only use wheels compatible with . Defaults to the platform of the running system.cCs|sdS|d}t|dkr"dSt|dkrV|d}t|dkrV|d|ddg}ztdd |D}Wntk rYd SX|dfS) z Convert a version string like "3", "37", or "3.7.3" into a tuple of ints. :return: A 2-tuple (version_info, error_msg), where `error_msg` is non-None if and only if there was a parsing error. )NN.)r$z'at most three version parts are allowedrNcss|]}t|VqdSr-)rt).0partr$r$r% sz*_convert_python_version..)r$z$each version part must be an integer)rlentuple ValueError)rQparts version_infor$r$r%_convert_python_versions    rcCs:t|\}}|dk r.d||}t|||d||j_dS)z3 Handle a provided --python-version value. Nz(invalid --python-version value: {!r}: {}r"r#)rrr&rrA)r"rrQr!r error_msgr#r$r$r%_handle_python_versions rz--python-versionrAa The Python interpreter version to use for wheel and "Requires-Python" compatibility checks. Defaults to a version derived from the running interpreter. The version can be specified using up to three dot-separated integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor version can also be given as a string without dots (e.g. "37" for 3.7.0). )r[rnr\rrkr`rZz--implementationrDzOnly use wheels compatible with Python implementation , e.g. 'pp', 'jy', 'cp', or 'ip'. If not specified, then the current interpreter implementation is used. Use 'py' to force implementation-agnostic wheels.z--abirCzOnly use wheels compatible with Python abi , e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Generally you will need to specify --implementation, --platform, and --python-version when using this option.cCs4|t|t|t|tdSr-)r)rBrArDrC)cmd_optsr$r$r%add_target_python_optionsYs   rcCst|j|j|j|jd}|S)N)rBpy_version_inforCrD)rrBrArCrD)r( target_pythonr$r$r%make_target_pythonasrcCstddddddS)Nz--prefer-binary prefer_binaryr^Fz8Prefer older binary packages over newer source packages.r_rr$r$r$r%rmsrz --cache-dir cache_dirzStore the cache data in .)r[r`rnrkrZc CsV|dk rJz t|Wn4tk rH}zt||t|dW5d}~XYnXd|j_dS)z Process a value provided for the --no-cache-dir option. This is an optparse.Option callback for the --no-cache-dir option. NrF)rrr&rqrr)r"rPrQr!excr$r$r%_handle_no_cache_dirs  $ rz--no-cache-dirzDisable the cache.)r[r\rrZz --no-depsz--no-dependenciesrFz#Don't install package dependencies.cCs$|rtj|}t|j|j|dSr-r)r"rPrQr!r$r$r%_handle_build_dirs rz-bz--buildz --build-dirz--build-directory build_dira>Directory to unpack packages into and build in. Note that an initial build still takes place in a temporary directory. The location of temporary directories can be controlled by setting the TMPDIR environment variable (TEMP on Windows) appropriately. When passed, build directories are not cleaned in case of failures.)r[rkrnr\rrZz--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationbuild_isolation store_falseTzDisable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used.cCs&|dk rd}t|||dd|j_dS)z Process a value provided for the --no-use-pep517 option. This is an optparse.Option callback for the no_use_pep517 option. Na0A value was passed for --no-use-pep517, probably using either the PIP_NO_USE_PEP517 environment variable or the "no-use-pep517" config file option. Use an appropriate value of the PIP_USE_PEP517 environment variable or the "use-pep517" config file option instead. rF)r&r use_pep517)r"rPrQr!r#r$r$r%_handle_no_use_pep517s rz --use-pep517rz^Use PEP 517 for building source distributions (use --no-use-pep517 to force legacy behaviour).z--no-use-pep517)r[r\rr`rZz--install-optionr5rr(a"Extra arguments to be supplied to the setup.py install command (use like --install-option="--install-scripts=/usr/local/bin"). Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.)r[r\rnrZz--global-optionr4zTExtra global options to be supplied to the setup.py call before the install command.z --no-cleanz!Don't clean up build directories.)r\r`rZz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--disable-pip-version-checkdisable_pip_version_checkz{Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.z-Zz--always-unzip always_unzipcCs|jjsi|j_z|dd\}}Wn$tk rH|d|YnX|tkrj|d|dt|jj|g |dS)zkGiven a value spelled "algo:digest", append the digest to a list pointed to in a dict by the algo name.:rzTArguments to {} must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for {} are {}.z, N) rhashesrrr rrr setdefaultr)r"rrQr!algodigestr$r$r%_handle_merge_hashEs rz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)r[r\rrkrZz--require-hashesrequire_hasheszRequire a hash to check each requirement against, for repeatable installs. This option is implied when any package in a requirements file has a --hash option.z--pathz^Restrict to the specified installation path for listing packages (can be used multiple times).)r[rkr\rZcCs|jr|js|jrtddS)Nz2Cannot combine '--path' with '--user' or '--local')rNuserlocalr )r(r$r$r%check_list_path_option|srz--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.z--unstable-featureunstable_featuresfeatureresolver)r[rnr\r`rlrZzGeneral Options)r'r(zPackage Index Options)N)F)z__doc__ __future__rloggingrMrr<distutils.utilr functoolsroptparserrrrpip._internal.cli.progress_barsr pip._internal.exceptionsr pip._internal.locationsr r #pip._internal.models.format_controlr pip._internal.models.indexr"pip._internal.models.target_pythonrpip._internal.utils.hashesrpip._internal.utils.typingrtypingrrrrrrrpip._internal.cli.parserr getLoggerrTloggerr&r,r@rLrRrShelp_r]require_virtualenvrbrdrerflistkeysrrgrmrorprsrwrzrr simple_urlrrrrrrrrrsrcrrrrrrBrrrArDrCrrrrrno_cacheno_depsrrrno_build_isolationrr no_use_pep517r5r4no_cleanprerrrhashr list_pathrrunstable_feature general_group index_groupr$r$r$r%st               (