efHdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZmZmZmZddlZddlZddlmZddlmZddlmZdd l mZdd lmZgd Zejd d Z de !ddvZ"Gdde#Z$Gddej%j&Z&ej'dZ(dZ)dZ*dZ+ej'dZ,ee e-ee-ee-dffZ. GddZ/Gdde/Z0Gdde0Z1e0Z2e2j3Z3e2j4Z4e2j5Z5e2j6Z6e2j7Z7e"se2j8Z8e2j9Z9e2j:Z:e1Z;dS) a-A PEP 517 interface to setuptools Previously, when a user or a command line tool (let's call it a "frontend") needed to make a request of setuptools to take a certain action, for example, generating a list of installation requirements, the frontend would would call "setup.py egg_info" or "setup.py bdist_wheel" on the command line. PEP 517 defines a different method of interfacing with setuptools. Rather than calling "setup.py" directly, the frontend should: 1. Set the current directory to the directory with a setup.py file 2. Import this module into a safe python interpreter (one in which setuptools can potentially set global variables or crash hard). 3. Call one of the functions defined in PEP 517. What each function does is defined in PEP 517. However, here is a "casual" definition of the functions (this definition should not be relied on for bug reports or API stability): - `build_wheel`: build a wheel in the folder and return the basename - `get_requires_for_build_wheel`: get the `setup_requires` to build - `prepare_metadata_for_build_wheel`: get the `install_requires` - `build_sdist`: build an sdist in the folder and return the basename - `get_requires_for_build_sdist`: get the `setup_requires` to build Again, this is not a formal definition! Just a "taste" of the module. N)Path)DictIteratorListOptionalUnion)errors) same_path) parse_strings)SetuptoolsDeprecationWarning) strtobool) get_requires_for_build_sdistget_requires_for_build_wheel prepare_metadata_for_build_wheel build_wheel build_sdistget_requires_for_build_editable#prepare_metadata_for_build_editablebuild_editable __legacy__SetupRequirementsErrorSETUPTOOLS_ENABLE_FEATURESzlegacy-editable_-ceZdZdZdS)rc||_dSN) specifiers)selfr s u/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/build_meta.py__init__zSetupRequirementsError.__init__Ds $N)__name__ __module__ __qualname__r#r$r"rrCs#%%%%%r$rcDeZdZdZeejdZdS) DistributioncXtt|}t|r)listr r)r!r specifier_lists r"fetch_build_eggszDistribution.fetch_build_eggsIs%mJ7788$^444r$c#Ktjj}|tj_ dV|tj_dS#|tj_wxYw)zw Replace distutils.dist.Distribution with this class for the duration of this context. N) distutilscorer*)clsorigs r"patchzDistribution.patchNsP~*&) # / EEE*.IN ' ' '$IN ' . . . .s =AN)r%r&r'r. classmethod contextlibcontextmanagerr4r(r$r"r*r*HsL555  / /[ / / /r$r*c#Ktj}dt_ dV|t_dS#|t_wxYw)a Temporarily disable installing setup_requires Under PEP 517, the backend reports build dependencies to the frontend, and the frontend is responsible for ensuring they're installed. So setuptools (acting as a backend) should not try to install them. cdSrr()attrss r"z+no_install_setup_requires..gstr$N) setuptools_install_setup_requires)r3s r"no_install_setup_requiresr>^sK  -D););J&2 -1 ***T *1111s/=cDfdtjDS)Ncg|]A}tjtj|?|BSr()ospathisdirjoin).0namea_dirs r" z1_get_immediate_subdirectories..osM   bgmmBGLLPTz'_file_with_extension..us4JJaAJJy4I4IJJJJJJJr$z[No distribution was found. Ensure that `setup.py` is not empty and that it calls `setup()`.)rArI ValueError) directoryrPmatchingfiles ` r"_file_with_extensionrVtsmJJJJ2:i00JJJH      8    Ks (Actj|stjdSt t dt|S)Nz%from setuptools import setup; setup()open)rArBexistsioStringIOgetattrtokenizerX setup_scripts r"_open_setup_scriptr`sF 7>>, ' 'E{CDDD *78VT * *< 8 88r$c#Ktj5tjdddVddddS#1swxYwYdS)Nignorezsetup.py install is deprecated)warningscatch_warningsfilterwarningsr(r$r"suppress_known_deprecationrfs  " "*JKKK s=AAceZdZdZdededeefdZdedeefdZ dedeefdZ dedeefdZ dedeefd Z d S) _ConfigSettingsTranslatorzTranslate ``config_settings`` into distutils-style command arguments. Only a limited number of options is currently supported. keyconfig_settingsreturnc|pi}||pg}t|trtj|n|S)aA Get the value of a specific key in ``config_settings`` as a list of strings. >>> fn = _ConfigSettingsTranslator()._get_config >>> fn("--global-option", None) [] >>> fn("--global-option", {}) [] >>> fn("--global-option", {'--global-option': 'foo'}) ['foo'] >>> fn("--global-option", {'--global-option': ['foo']}) ['foo'] >>> fn("--global-option", {'--global-option': 'foo'}) ['foo'] >>> fn("--global-option", {'--global-option': 'foo bar'}) ['foo', 'bar'] )get isinstancestrshlexsplit)r!rirjcfgoptss r" _get_configz%_ConfigSettingsTranslator._get_configsF$#wws||!r$.tS$9$9Cu{4   tCr$c#K|pi}hd}d|vsd|vrUt|dp|dpd}||vrdndVd|vsd|vrUt|dp|dpd}||vrdndV|d |Ed {Vd S) a Let the user specify ``verbose`` or ``quiet`` + escape hatch via ``--global-option``. Note: ``-v``, ``-vv``, ``-vvv`` have similar effects in setuptools, so we just have to cover the basic scenario ``-v``. >>> fn = _ConfigSettingsTranslator()._global_args >>> list(fn(None)) [] >>> list(fn({"verbose": "False"})) ['-q'] >>> list(fn({"verbose": "1"})) ['-v'] >>> list(fn({"--verbose": None})) ['-v'] >>> list(fn({"verbose": "true", "--global-option": "-q --no-user-cfg"})) ['-v', '-q', '--no-user-cfg'] >>> list(fn({"--quiet": None})) ['-q'] >0noofffalseverbosez --verbose1z-qz-vquietz--quietz--global-optionN)rormlowerrt)r!rjrrfalseylevels r" _global_argsz&_ConfigSettingsTranslator._global_argss*#,,,   {c11 **Icggk.B.BIcJJE ;;==F2244 = = = c>>Y#--((ECGGI,>,>E#FFE ;;==F2244 = = =##$5GGGGGGGGGGGr$c#K|pi}d|vr,tt|dpd}|rdndVd|vrdt|dgEd{VdSdS)a The ``dist_info`` command accepts ``tag-date`` and ``tag-build``. .. warning:: We cannot use this yet as it requires the ``sdist`` and ``bdist_wheel`` commands run in ``build_sdist`` and ``build_wheel`` to reuse the egg-info directory created in ``prepare_metadata_for_build_wheel``. >>> fn = _ConfigSettingsTranslator()._ConfigSettingsTranslator__dist_info_args >>> list(fn(None)) [] >>> list(fn({"tag-date": "False"})) ['--no-date'] >>> list(fn({"tag-date": None})) ['--no-date'] >>> list(fn({"tag-date": "true", "tag-build": ".a"})) ['--tag-date', '--tag-build', '.a'] ztag-dateryz --tag-datez --no-datez tag-buildz --tag-buildN)rro)r!rjrrvals r"__dist_info_argsz*_ConfigSettingsTranslator.__dist_info_argss&#   CJ :7;;<>> fn = _ConfigSettingsTranslator()._editable_args >>> list(fn(None)) [] >>> list(fn({"editable-mode": "strict"})) ['--mode', 'strict'] z editable-mode editable_modeNz--mode)rmro)r!rjrrmodes r"_editable_argsz(_ConfigSettingsTranslator._editable_argssj#ww''C377?+C+C  Fc$ii((((((((((r$c#BK|d|Ed{VdS)av Users may expect to pass arbitrary lists of arguments to a command via "--global-option" (example provided in PEP 517 of a "escape hatch"). >>> fn = _ConfigSettingsTranslator()._arbitrary_args >>> list(fn(None)) [] >>> list(fn({})) [] >>> list(fn({'--build-option': 'foo'})) ['foo'] >>> list(fn({'--build-option': ['foo']})) ['foo'] >>> list(fn({'--build-option': 'foo'})) ['foo'] >>> list(fn({'--build-option': 'foo bar'})) ['foo', 'bar'] >>> list(fn({'--global-option': 'foo'})) [] z--build-optionN)rtr!rjs r"_arbitrary_argsz)_ConfigSettingsTranslator._arbitrary_argss7*##$4oFFFFFFFFFFFr$N) r%r&r'__doc__ro_ConfigSettingsrrtrr)_ConfigSettingsTranslator__dist_info_argsrrr(r$r"rhrhs DsD_DcDDDD,HOH HHHH@>>HSM>>>>4)o)(3-)))) GG8C=GGGGGGr$rhceZdZdZddZddZddZdeded efd Zdeded e fd Z dd Z d Z ddZ ddZdeed eefdZes ddZddZ ddZdSdS)_BuildMetaBackendcDgtjdd||dt_ t5|dddn #1swxYwYn!#t $r}||jz }Yd}~nd}~wwxYw|S)Nr egg_info)sysargvrr*r4 run_setuprr )r!rj requirementses r"_get_build_requiresz%_BuildMetaBackend._get_build_requiress Xbqb\    / /     )##%% ! !    ! ! ! ! ! ! ! ! ! ! ! ! ! ! !% ) ) ) AL (LLLLLL )s;A?A3' A?3A77A?:A7;A?? B BBsetup.pyctj|}d}t|5}|dd}dddn #1swxYwY t |tdS#t$r*}|j rtj dddYd}~dSd}~wwxYw)N__main__z\r\nz\nz6Running `setup.py` directly as CLI tool is deprecated.znPlease avoid using `sys.exit(0)` or similar statements that don't fit in the paradigm of a configuration file.zAhttps://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html)see_url) rArBabspathr`readreplaceexeclocals SystemExitcoder emit)r!r___file__r%rOrrs r"rz_BuildMetaBackend.run_setup-s*7??<00  ) ) 4Q6688##GU33D 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4  vxx    v  ( -HJ+            s))A&&A*-A*2B CB??CNc2||dgS)Nwheelrrrs r"rz._BuildMetaBackend.get_requires_for_build_wheelDs''wi'PPPr$c0||gS)Nrrrs r"rz._BuildMetaBackend.get_requires_for_build_sdistGs''b'IIIr$metadata_directorysuffixrkc|||}t|j|s"tjt |||jS)z PEP 517 requires that the .dist-info directory be placed in the metadata_directory. To comply, we MUST copy the directory to the root. Returns the basename of the info directory, e.g. `proj-0.0.0.dist-info`. )_find_info_directoryr parentshutilmoverorF)r!rrinfo_dirs r"_bubble_up_info_directoryz+_BuildMetaBackend._bubble_up_info_directoryJsP,,-?HH*<== ; KH '9 : : :}r$cLtj|D]s\}}}fd|D}t|dkst|dkr9t|dksJddt||dcStdd|}t j|)Nc>g|]}||Sr(rM)rErOrs r"rHz:_BuildMetaBackend._find_info_directory..Ys*@@@QZZ-?-?@!@@@r$rr z Multiple z directories foundzNo z directory found in )rAwalklenrr InternalError)r!rrrdirsr candidatesmsgs ` r"rz&_BuildMetaBackend._find_info_directoryWs!w'9:: 3 3OFD!@@@@T@@@J:!##s4yyA~~:!+++-S-S-S-S+++FJqM22222(6EFDD0BDD"3'''r$cHgtjdd||dd|dt_t5|dddn #1swxYwY||d||dS)Nr dist_infoz --output-dirz--keep-egg-infoz .egg-infoz .dist-info)rrrr>rrr!rrjs r"rz2_BuildMetaBackend.prepare_metadata_for_build_wheelbs Xbqb\    / /          ' ( (   NN                   &&'9;GGG--.@,OOOs A--A14A1ctj|}tj|dd|d}t jdi|5}gt jdd|||d|t _t5| dddn #1swxYwYt||}tj ||}tj |rtj|tjtj |||dddn #1swxYwY|S)NT)exist_okz.tmp-)prefixdirr z --dist-dirr()rArBrmakedirstempfileTemporaryDirectoryrrrr>rrVrDrYremoverename) r! setup_commandresult_extensionresult_directoryrj temp_opts tmp_dist_dirresult_basename result_paths r"_build_with_temp_dirz&_BuildMetaBackend._build_with_temp_dirss7??+;<< $t4444&/?@@  ( 5 59 5 5 P"1"""?33   CH+,, ! !    ! ! ! ! ! ! ! ! ! ! ! ! ! ! !3B; ?BE$$E(+E(ct5|dg||d||cdddS#1swxYwYdS)N bdist_wheel.whl)rfrr)r!wheel_directoryrjrs r"rz_BuildMetaBackend.build_wheels( ) )  ,,G!5!5o!F!FG                   s.A  AAc6|gdd||S)N)sdistz --formatsgztarz.tar.gz)r)r!sdist_directoryrjs r"rz_BuildMetaBackend.build_sdists)(( + + +Y   r$c|sdStt|d}t|dksJ|rt |dndS)Nz *.dist-infor r)r,rglobrro)r!rdist_info_candidatess r"_get_dist_info_dirz$_BuildMetaBackend._get_dist_info_dirsl! 4#D);$<$<$A$A-$P$PQQ'((A----/CMs'*+++Mr$c||}|rd|gng}dg|||}t5||d||cdddS#1swxYwYdS)Nz--dist-info-direditable_wheelr)rrrfr)r!rrjrrrscmds r"rz _BuildMetaBackend.build_editables../ABBH4<D%x00"D#RdRT-@-@-Q-QRC+--  00/                  sA++A/2A/c,||Sr)rrs r"rz1_BuildMetaBackend.get_requires_for_build_editables44_EE Er$c.|||Sr)rrs r"rz5_BuildMetaBackend.prepare_metadata_for_build_editables!88"O r$rr)NN)r%r&r'rrrrrorrrrrrrrrLEGACY_EDITABLErrrr(r$r"rrs   .QQQQJJJJ C  QT     (s (C (D ( ( ( (37PPPP"<IM        NXc]NxPS}NNNN  MQ     F F F F7;      )r$rc$eZdZdZdfd ZxZS)_BuildMetaLegacyBackendaOCompatibility backend for setuptools This is a version of setuptools.build_meta that endeavors to maintain backwards compatibility with pre-PEP 517 modes of invocation. It exists as a temporary bridge between the old packaging mechanism and the new packaging mechanism, and will eventually be removed. rc.ttj}tjtj|}|tjvr tjd|tjd}|tjd< tt| ||tjdd<|tjd<dS#|tjdd<|tjd<wxYw)Nrr^) r,rrBrAdirnamerinsertrsuperrr)r!r_sys_path script_dir sys_argv_0 __class__s r"rz!_BuildMetaLegacyBackend.run_setups>>W__RW__\%B%BCC SX % % HOOAz * * * Xa[ "  % )4 0 0 : : : U U U#CHQQQK$CHQKKK#CHQQQK$CHQK $ $ $ $s ')C22"Dr)r%r&r'rr __classcell__)rs@r"rrsG  %%%%%%%%%%r$r)rJrVr`rfrorrhrr_BACKENDrrrrrrrrrr(r$r"rs[8  88888888888888 222222$$$$$$   'RY'CRHHNNPP#'A'I'I#s'S'SS%%%%%]%%% /////:?////,  2 2 2   999  4U3S 4+?%@ @AB |G|G|G|G|G|G|G|G~bbbbb1bbbJ%%%%%%%%%%/%%%%%%R    'D'D#+#L " " -&.&N#*2*V',N% $ & & r$