3 (\]@sdZddlmZddlZddlZddlmZddlmZddl m Z m Z m Z ddl mZddlmZmZdd lmZdd lmZdd lmZdd lmZdd lmZerddlmZmZmZm Z ddl m!Z!m"Z"ddl#m$Z$ddZ%ddZ&dddZ'dddZ(ee ddddddZ)ee dd d!dd"d#Z*ee d$d%d&d!de d#Z+ee d'd(d)d*dd+d#Z,ee d,d-d!dd.d#Z-ee d/d0d1d!d2dZ.ee d3d4d5d*dd6d#Z/ee d7d8d9e0ej1d:d;dZ3ee d?d@dAdBdCdDdEZ4ee dFdGd!de d#Z5ee dHdIdJdKdLdMZ6ee dNdOdPdQdRdMZ7ee dSdTdUdVdWdXdYdZZ8ee d[d\dJdKe dMZ9d]d^Z:ee d_d`dJdCdadbZ;ee dcdddJddCdedfZdndoZ?ee dpdqd!ddrd#Z@dsdtZAdudvZBdwdxZCdydzZDd{d|ZEee d}d~ddddeddm ZFddZGddZHddZIddZJddZKee ddddddmZLee ddddddmZMee ddddddmZNee ddddddmZOddZPee ddedddZQddZRee dddeRddZSee dddd!ddd#ZTee ddddddddEZUee ddd!ddZVee dddddd#ZWddZXee ddd!ddd#ZYee dddeXde dZZee ddddddčZ[ee ddddddčZ\ee dd!dddʍZ]ee dd!dddʍZ^ee ddd!ddd#Z_ee dddd!e dZ`ddԄZaee dddeadddٍZbee ddd!ddd#Zcde)e*e+e,e.e/e4e5e6e7e8e9e:eBe;ee?e@eAgdޜZedS)aD 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) CommandError)USER_CACHE_DIR src_prefix) FormatControl)PyPI) STRONG_HASHES)MYPY_CHECK_RUNNING) BAR_TYPES)AnyCallableDictOptional) OptionParserValues)ConfigOptionParsercCs.dj||}tjdj|j}|j|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!o/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-build-k1a8l1r5/pip/pip/_internal/cli/cmdoptions.pyraise_option_error s r#cCs0t||d}x|dD]}|j|qW|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_grouprr!r!r"make_option_group.sr)csPdkr |fdd}dddg}tt||rL|j}|jtjddd 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|dS)N)getattr)n) check_optionsr!r"getnameFsz+check_install_build_global..getname build_optionsglobal_optionsinstall_optionszeDisabling all use of wheels due to the use of --build-options / --global-options / --install-options.) stacklevel)anymapformat_controlZdisallow_binarieswarningswarn)r%r,r-namescontrolr!)r,r"check_install_build_global;s  r:FcCsdt|j|j|j|jg}ttdh}|j|ko6|j }|rH|rHt d|r`|r`|j r`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) r3python_versionplatformabiimplementationr setr5ignore_dependenciesr target_dir)r%Z check_targetdist_restriction_set binary_onlyZsdist_dependencies_allowedr!r!r"check_dist_restrictionRs   rDz-hz--helphelpz Show help.)destactionrEz --isolated isolated_mode store_truezSRun pip in an isolated mode, ignoring environment variables and user configuration.)rFrGdefaultrEz--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))rFtypechoicesrJrEz--logz --log-filez --local-loglogpathz Path to a verbose appending log.)rFmetavarrEz --no-inputno_inputz--proxyproxystrz/src". The default for global installs is "/src".cCs t||jS)zGet a format_control object.)r*rF)valuesrr!r!r"_get_format_controlsrcCs"t|j|}tj||j|jdS)N)rrr handle_mutual_excludes no_binary only_binary)ropt_strvaluerexistingr!r!r"_handle_no_binarys rcCs"t|j|}tj||j|jdS)N)rrr rrr)rrrrrr!r!r"_handle_only_binarys rc Cs$ttt}tdddtd|ddS)Nz --no-binaryr5callbackr\aRDo 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, or one or more package names with commas between them. Note that some packages are tricky to compile and may fail to install when this option is used on them.)rFrGrrUrJrE)r r?rr)r5r!r!r"rs rc Cs$ttt}tdddtd|ddS)Nz --only-binaryr5rr\aGDo 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.)rFrGrrUrJrE)r r?rr)r5r!r!r"rs rz --platformr<z[Only use wheels compatible with . Defaults to the platform of the running system.z--python-versionr;a!Only use wheels compatible with Python interpreter version . If not specified, then the current system interpreter minor version is used. A major version (e.g. '2') can be specified to match all minor revs of that major version. A minor version (e.g. '34') can also be specified.z--implementationr>zOnly 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--abir=zOnly 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.cCstddddddS)Nz--prefer-binary prefer_binaryrIFz8Prefer older binary packages over newer source packages.)rFrGrJrE)rr!r!r!r"r s rz --cache-dir cache_dirzStore the cache data in .)rFrJrYrEcCsV|dk rJy t|Wn4tk rH}zt||t|dWYdd}~XnXd|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. N)rr F)r ValueErrorr#r\rr)roptrrexcr!r!r"no_cache_dir_callback"s  $ rz--no-cache-dirrzDisable the cache.)rFrGrrEz --no-depsz--no-dependenciesr@z#Don't install package dependencies.z-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.z--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationZbuild_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. )rr F)r#r use_pep517)rrrrr r!r!r"no_use_pep517_callbackos rz --use-pep517rz^Use PEP 517 for building source distributions (use --no-use-pep517 to force legacy behaviour).z--no-use-pep517)rFrGrrJrEz--install-optionr0rlr%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.)rFrGrYrEz--global-optionr/zTExtra global options to be supplied to the setup.py call before the install command.z --no-cleanz!Don't clean up build directories.)rGrJrEz--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_unzipc Cs|jjsi|j_y|jdd\}}Wn"tk rF|jd|YnX|tkrh|jd|djtf|jjj|gj|dS)zkGiven a value spelled "algo:digest", append the digest to a list pointed to in a dict by the algo name.:zTArguments to %s must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for %s are %s.z, N) rhashesrrrr r setdefaultrl)rrrralgodigestr!r!r" _merge_hashsrz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)rFrGrrUrEz--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.zGeneral Options)r$r%zPackage Index Options)N)F)f__doc__ __future__rrr6distutils.utilr functoolsroptparserrrZpip._internal.exceptionsrZpip._internal.locationsr r Z#pip._internal.models.format_controlr Zpip._internal.models.indexr Zpip._internal.utils.hashesr Zpip._internal.utils.typingrZpip._internal.utils.uirZtypingrrrrrrZpip._internal.cli.parserrr#r)r:rDhelp_rHrequire_virtualenvrLrNrOrPlistkeysrrQrWrZr[r^rbrerfrmrn simple_urlrorrrsrtrxryr{r}srcrrrrrr<r;r>r=rrrno_cacheno_depsrrZno_build_isolationrrZ no_use_pep517r0r/no_cleanprerrrhashr general_group index_groupr!r!r!r" s            ,