a  ze-@sdZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z ddl mZmZddlmZmZddlmZddlmZmZddlmZdd lmZdd lmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%ddl&m'Z'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3e4e5Z6e7dej8Z9ee#ge:fZ;e e e#e e#fZddZ?ddZ@ddZAd d!ZBd"d#ZCd$d%ZDd&d'ZEd(d)ZFd*d+ZGd,d-ZHdS).z;Orchestrator for building wheels from InstallRequirements. N)AnyCallableIterableListOptionalTuple)canonicalize_namecanonicalize_version)InvalidVersionVersion) WheelCache)InvalidWheelFilenameUnsupportedWheel)get_wheel_distribution)Link)Wheel)build_wheel_pep517)build_wheel_legacy)InstallRequirement) indent_log) ensure_dir hash_fileis_wheel_installed)make_setuptools_clean_args)call_subprocess) TempDirectory) path_to_url)vcsz([a-z0-9_.]+)-([a-z0-9_.!+-]+)cCstt|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"]/opt/bitninja-python-dojo/embedded/lib/python3.9/site-packages/pip/_internal/wheel_builder.py_contains_egg_info%sr$cCs~|jr dS|jr&|r"td|jdS|r.dS|js:|js>dS|jrHdS||sbtd|jdStsztd|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_allowedr"r"r# _should_build.s6 r0cCst|dtdS)NTr.r/)r0 _always_true)r-r"r"r#should_build_for_wheel_command^sr3cCst|d|dS)NFr1)r0)r-r/r"r"r# should_build_for_install_commandgsr4cCs|js |jsdS|jrb|jjrb|jr(J|js2Jt|jj}|sHJ||jj|jr^dSdS|jslJ|j \}}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_vcsrget_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr$)r- vcs_backendbaseextr"r"r# _should_cacheqs    r?cCs>t|j}|jsJ|r.t|r.||j}n ||j}|S)zdReturn the persistent or temporary cache directory where the built wheel need to be stored. )r cache_dirr5r?get_path_for_linkget_ephem_path_for_link)r- wheel_cachecache_availabler@r"r"r#_get_cache_dirs     rEcCsdS)NTr")_r"r"r#r2sr2c Cst|jp d}ttj|}t|j|kr>td||jt||}t |j }t |t |j krvtd||j |j }|durt dz t|}Wn$tyd|}t |Yn0|tdkrt|j tst d|dS)Nz7Wheel has unexpected file name: expected {!r}, got {!r}zMissing Metadata-VersionzInvalid Metadata-Version: z1.2z6Metadata 1.2 mandates PEP 440 version, but {!r} is not)rr)rospathbasenamer formatrstrversionr metadata_versionrr r isinstance) r- wheel_pathcanonical_namewdist dist_verstrmetadata_version_valuerNmsgr"r"r# _verify_ones@       rWc Csz t|Wn6tyB}ztd|j|WYd}~dSd}~00|jt||||}Wdn1sn0Y|r|rzt||Wn:tt fy}ztd|j|WYd}~dSd}~00|S)zaBuild one wheel. :return: The filename of the built wheel, or None if the build failed. Building wheel for %s failed: %sNz!Built wheel for %s is invalid: %s) rOSErrorr'warningr) build_env_build_one_inside_envrWr r)r- output_dirverify build_optionsglobal_optionserPr"r"r# _build_ones&  "rbc CsptddN}|jsJ|jrp|js(J|js2J|rDtd|j|rVtd|jt|j|j|j|jd}nt |j|j |j |||jd}|dur8t j |}t j||}zPt|\}} t||td|j|| |td||WWdSty6} ztd |j| WYd} ~ n d} ~ 00|jsJt||WddS1sb0YdS) Nwheel)kindz7Ignoring --global-option when building %s using PEP 517z6Ignoring --build-option when building %s using PEP 517)r)backendmetadata_directorytempd)r) setup_py_pathr+r`r_rgz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %srX)rr)r,rfpep517_backendr'rZrrIrrhunpacked_source_directoryrHrJjoinrshutilmover( hexdigest Exception_clean_one_legacy) r-r]r_r`temp_dirrP wheel_name dest_path wheel_hashlengthrar"r"r#r\s^         r\cCsXt|j|d}td|jzt||jdWdStyRtd|jYdS0dS)N)r`zRunning setup.py clean for %s)cwdTz Failed cleaning build dir for %sF) rrhr'r(r)rr+roerror)r-r` clean_argsr"r"r#rp&s rpc Cs|s ggfStdddd|Dt|gg}}|D]\}t||}t|||||} | rtt| |_|jj |_ |jj sJ| |q>| |q>Wdn1s0Y|rtdddd |D|rtd dd 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)Nr).0r-r"r"r# Izbuild..NzSuccessfully built %s cSsg|] }|jqSr"ryrzr"r"r# `r}zbuild..zFailed to build %scSsg|] }|jqSr"ryrzr"r"r#rer}) r'r(rkrrErbrrr5 file_pathlocal_file_pathr&append) requirementsrCr^r_r`build_successesbuild_failuresr-r@ wheel_filer"r"r#build6s<       *r)I__doc__loggingos.pathrHrerltypingrrrrrrpip._vendor.packaging.utilsrr Zpip._vendor.packaging.versionr r pip._internal.cacher pip._internal.exceptionsr rpip._internal.metadatarpip._internal.models.linkrpip._internal.models.wheelr$pip._internal.operations.build.wheelr+pip._internal.operations.build.wheel_legacyrZpip._internal.req.req_installrpip._internal.utils.loggingrpip._internal.utils.miscrrr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrpip._internal.utils.urlsrpip._internal.vcsr getLogger__name__r'compile IGNORECASErrBinaryAllowedPredicate BuildResultr$r0r3r4r?rEr2rWrbr\rprr"r"r"r#sL                0  ! #;