U
.eh @ s d Z ddlmZ ddlZddlZddlZddlmZ ddlm Z ddl
mZmZm
Z
ddlmZ ddlmZ dd lmZmZ dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ erddl m!Z!m"Z"m#Z#m$Z$m%Z% ddl
m&Z&m'Z' ddl(m)Z) e*e+Z,dd Z-dd Z.dddZ/dddZ0e edddddd Z1e ed!d"d#dd$d%Z2e ed&d'd(d#ded%Z3e ed)d*d+d,dd-d%Z4e ed.d/d#dd0d%Z5e ed1d2d3d#d4d Z6e ed5d6d7d,dd8d%Z7e ed9d:d;e8e9 d:e9 d? d@Z;e edAdBdCdDdEdFdGZe edPdQdRdSdTdOZ?e edUdVdWdXdYdZd[d\Z@e ed]d^dLdMedOZAd_d` ZBe edadbdLdEdcddZCe ededfdLddEdgdhZDe edidjdkdldmejEdndoZFdpdq ZGe edrdsd#ddtd%ZHdudv ZIdwdx ZJdydz ZKd{d| ZLd}d~ ZMe edddddde ddo ZNdd ZOdd ZPdd ZQdd ZRdd ZSe eddddddoZTdd ZUdd ZVe eddddeVdLdedd ZWe eddddddoZXe eddddddoZYdd ZZdd Z[dd Z\e eddedddZ]dd Z^e eddde^ddZ_e edddd#ddd%Z`e eddddddddGZae eddd#dd Zbe edddddd%ZcddĄ Zde eddd#ddd%Zee edddeddedɍZfe eddddddύZge eddddddύZhe edd#dddՍZie edd#dddՍZje eddd#ddd%Zke edddd#ed Zldd߄ Zme edddemdddZne eddd#ddd%Zoe eddEddd Zpdd Zqde1e2e3e4e6e7ee?e@eAeBeJeCeDe]e_eke5gdZrdeFeGeHeIgdZsdS )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_HELPOptionOptionGroup)dedent)CommandError)USER_CACHE_DIRget_src_prefix)
FormatControl)PyPI)TargetPython)
STRONG_HASHES)MYPY_CHECK_RUNNING) BAR_TYPES)AnyCallableDictOptionalTuple)OptionParserValues)ConfigOptionParserc C s. 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)formattextwrapZfilljoinspliterror)parseroptionmsg r# @/usr/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.pyraise_option_error) s r% c C s, t || d }| d D ]}|| 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 Zoption_groupr! r# r# r$ make_option_group7 s r* c sP dkr| fdd}dddg}t t||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.
Nc s t | d S N)getattr)n
check_optionsr# r$ getnameO s z+check_install_build_global..getnameZ
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/ r0 namesZcontrolr# r. r$ check_install_build_globalD s
r; Fc C sb t | j| j| j| jg}tt dh}| 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)r5 python_versionplatformabiimplementationr setr7 ignore_dependenciesr Z
target_dir)r' Zcheck_targetZdist_restriction_setZbinary_onlyZsdist_dependencies_allowedr# r# r$ check_dist_restriction[ s&