Re2%@sdZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZerqddlmZm Z m!Z!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(e e(ge)fZ*e$e"e(e"e(fZ+ej,e-Z.ej/dej0Z1ddZ2ddZ3ddZ4ddZ5ddZ6ddZ7ddZ8d d!Z9d"d#Z:d$d%Z;d&d'Z<dS)(z;Orchestrator for building wheels from InstallRequirements. N)Link)build_wheel_pep517)build_wheel_legacy) indent_log) ensure_dir hash_fileis_wheel_installed)make_setuptools_clean_args)call_subprocess) TempDirectory)MYPY_CHECK_RUNNING) path_to_url)vcs)AnyCallableIterableListOptionalTuple) WheelCache)InstallRequirementz([a-z0-9_.]+)-([a-z0-9_.!+-]+)cCsttj|S)zjDetermine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 )bool _egg_info_research)sr/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/wheel_builder.py_contains_egg_info%srcCs|jr dS|jr3|r/tjd|jdS|r=dS|jsP|j rTdS||swtjd|jdS|j rt rtjd|jdSdS)zBReturn whether an InstallRequirement should be built into a wheel.Fz(Skipping %s, due to already being wheel.TzCSkipping wheel build for %s, due to binaries being disabled for it.zOUsing legacy 'setup.py install' for %s, since package 'wheel' is not installed.) constraintis_wheelloggerinfonameeditable source_dir use_pep517r)req need_wheelcheck_binary_allowedrrr _should_build.s,      r)cCst|dddtS)Nr'Tr()r) _always_true)r&rrrshould_build_for_wheel_command[sr+cCst|ddd|S)Nr'Fr()r))r&r(rrr should_build_for_install_commanddsr,cCs|js|j rdS|jr|jjr|j s<t|jsKttj|jj}|slt|j|jj |jrdSdS|jst|jj \}}t |rdSdS)z Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built. FT) r#r$linkis_vcsAssertionErrorrget_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr)r& vcs_backendbaseextrrr _should_cachens   r8cCs[t|j}|jst|rEt|rE|j|j}n|j|j}|S)zdReturn the persistent or temporary cache directory where the built wheel need to be stored. )r cache_dirr-r/r8get_path_for_linkget_ephem_path_for_link)r& wheel_cachecache_availabler9rrr_get_cache_dirs r>cCsdS)NTr)_rrrr*sr*cCsxyt|Wn?tk rO}ztjd|j|dSWYdd}~XnX|jt||||SWdQRXdS)zaBuild one wheel. :return: The filename of the built wheel, or None if the build failed. z Building wheel for %s failed: %sN)rOSErrorr warningr" build_env_build_one_inside_env)r& output_dir build_optionsglobal_optionserrr _build_ones   rHc Cstdd}|js!t|jro|js9ttd|jd|jd|jd|d|j}n9td|jd|j d |j d |d|d|j}|dk rut jj |}t jj ||}y\t|\}} tj||tjd |j|| |jtjd ||SWn;tk rt} ztjd |j| WYdd} ~ XnX|jst||dSWdQRXdS)Nkindwheelr"backendmetadata_directoryrEtempd setup_py_pathr$rFz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %sz Building wheel for %s failed: %s)r r"r/r%rLrpep517_backendpathrrNunpacked_source_directoryosbasenamejoinrshutilmover r! hexdigest ExceptionrA_clean_one_legacy) r&rDrErFtemp_dir wheel_path wheel_name dest_path wheel_hashlengthrGrrrrCsF               rCc Csst|jd|}tjd|jyt|d|jdSWn)tk rntjd|jdSYnXdS)NrFzRunning setup.py clean for %scwdTz Failed cleaning build dir for %sF) r rNr r!r"r r$rXerror)r&rF clean_argsrrrrYs   rYc CsD|sggfStjddjdd|Dtgg}}x|D]}t||}t||||}|rtt||_|jj |_ |jj st |j |qT|j |qTWWdQRX|rtjddjdd |D|r:tjd djd d |D||fS) zBuild wheels. :return: The list of InstallRequirement that succeeded to build and the list of InstallRequirement that failed to build. z*Building wheels for collected packages: %sz, css|]}|jVqdS)N)r").0r&rrr szbuild..NzSuccessfully built %s cSsg|]}|jqSr)r")rcr&rrr ,s zbuild..zFailed to build %scSsg|]}|jqSr)r")rcr&rrrrf1s )r r!rTrr>rHrr r- file_pathlocal_file_pathrr/append) requirementsr<rErFbuild_successesbuild_failuresr&r9 wheel_filerrrbuilds4     rn)=__doc__loggingos.pathrRrerUpip._internal.models.linkr$pip._internal.operations.build.wheelr+pip._internal.operations.build.wheel_legacyrpip._internal.utils.loggingrpip._internal.utils.miscrrr$pip._internal.utils.setuptools_buildr pip._internal.utils.subprocessr pip._internal.utils.temp_dirr pip._internal.utils.typingr pip._internal.utils.urlsr pip._internal.vcsrtypingrrrrrrpip._internal.cacherZpip._internal.req.req_installrrZBinaryAllowedPredicateZ BuildResult getLogger__name__r compile IGNORECASErrr)r+r,r8r>r*rHrCrYrnrrrrsD    . - !    3