o ~ReN@sdZddlmZddlmZddlmZmZddlmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZdd lmZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd l Z dd l!Z!dd l"Z"dd l#Z#dd l$Z$dd l%Z%dd l&Z&dd l'm(Z(m)Z)dd l*m+Z+dd l*m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6ddl/m7Z7m8Z8ddl9m:Z:ddl;mZ>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJdd l;Z;ejKde;jLdgdZMddZNddZOddZPddZQd d!ZRGd"d#d#e,ZSd$d%ZTd&d'ZUd(d)ZVd*d+ZWd,d-ZXGd.d/d/eBZYGd0d1d1eYZZej[\d2d3d4krBeZZYd5d6Z]d7d8Z^d9d:Z_d;d<Z`did=d>Zad?d@ZbdAdBZcdCejdvrhecZendDdEZedjdGdHZfdIdJZgdKdLZhdMdNZizddOlmjZkWnelydPdQZkYnwdRdSZjGdTdUdUemZnenoZpGdVdWdWenZqGdXdYdYZrGdZd[d[erZsGd\d]d]esZterjuZuerjvZvd^d_Zwd`daZxdbe^fdcddZydedfZzGdgdhdhe+Z{d S)ka0 Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ https://setuptools.readthedocs.io/en/latest/deprecated/easy_install.html )glob) get_platform) convert_path subst_vars)DistutilsArgErrorDistutilsOptionErrorDistutilsErrorDistutilsPlatformError)INSTALL_SCHEMES SCHEME_KEYS)logdir_util) first_line_re)find_executableN)get_config_varsget_path)SetuptoolsDeprecationWarning)Command) run_setup)setopt)unpack_archive) PackageIndexparse_requirement_arg URL_SCHEME) bdist_eggegg_info)Wheel) yield_linesnormalize_pathresource_stringensure_directoryget_distributionfind_distributions Environment Requirement Distribution PathMetadata EggMetadata WorkingSetDistributionNotFoundVersionConflict DEVELOP_DISTdefault)category)samefile easy_installPthDistributionsextract_wininst_cfgget_exe_prefixescCstddkS)NP)structcalcsizer7r7/builddir/build/BUILDROOT/alt-python310-setuptools-58.3.0-2.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/setuptools/command/easy_install.pyis_64bitJr9cCsjtj|o tj|}ttjdo|}|rtj||Stjtj|}tjtj|}||kS)z Determine if two paths reference the same file. Augments os.path.samefile to work on Windows and suppresses errors if the path doesn't exist. r.)ospathexistshasattrr.normpathnormcase)p1p2Z both_existZ use_samefileZnorm_p1Znorm_p2r7r7r8r.Nsr.cCs |dS)Nutf8)encodesr7r7r8 _to_bytes^s rGcCs&z|dWdStyYdSw)NasciiTF)rD UnicodeErrorrEr7r7r8isasciibs   rJcCst|ddS)N z; )textwrapdedentstripreplace)textr7r7r8 _one_linerjsrQc@szeZdZdZdZdZdddddd d d d d ddddddddddddddejfgZgdZ ddiZ e Z dd Z d!d"Zd#d$Zed%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zdd1d2Zd3d4Zd5d6Zd7d8Zed9Zed:Zed;Z dd?Z"d@dAZ#dBdCZ$dDdEZ%dFdGZ&e'j(dHdIZ)ddKdLZ*ddMdNZ+dOdPZ, ddQdRZ-dSdTZ.dUdVZ/dWdXZ0ddYdZZ1ed[d\Z2dd_d`Z3dadbZ4dcddZ5dedfZ6dgdhZ7didjZ8dkdlZ9edmZ:ednZ;ddpdqZdudvZ?dwdxZ@dydzZAd{d|ZBd}d~ZCddZDddZEedFZGddZHeIeIddddZJeIdddZKddZLdS)r/z'Manage a download/build/install processz Find/get/install Python packagesT)zprefix=Nzinstallation prefix)zip-okzzinstall package as a zipfile) multi-versionmz%make apps have to require() a version)upgradeUz1force upgrade (searches PyPI for latest versions))z install-dir=dzinstall package to DIR)z script-dir=rFzinstall scripts to DIR)exclude-scriptsxzDon't install scripts) always-copyaz'Copy all needed packages to install dir)z index-url=iz base URL of Python Package Index)z find-links=fz(additional URL(s) to search for packages)zbuild-directory=bz/download/extract/build in DIR; keep the results)z optimize=Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])zrecord=Nz3filename in which to record list of installed files) always-unzipZz*don't install as a zipfile, no matter what)z site-dirs=Sz)list of directories where .pth files work)editableez+Install specified packages in editable form)no-depsNzdon't install dependencies)z allow-hosts=Hz$pattern(s) that hostnames must match)local-snapshots-oklz(allow building eggs from local checkouts)versionNz"print version information and exit)z no-find-linksNz9Don't load find-links defined in packages being installeduserNz!install in user site-package '%s') rRrTrYrVr[rdrfrirkrlrarRcCs2tdtd|_d|_|_d|_|_|_d|_ d|_ d|_ d|_ d|_ |_d|_|_|_d|_|_|_d|_|_|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ t!j"rlt!j#|_$t!j%|_&nd|_$d|_&d|_'d|_(d|_)|_*d|_+i|_,d|_-|j.j/|_/|j.0||j.1ddS)NzVeasy_install command is deprecated. Use build and pip and other standards-based tools.rr/)2warningswarnEasyInstallDeprecationWarningrlzip_oklocal_snapshots_ok install_dir script_direxclude_scripts index_url find_linksbuild_directoryargsoptimizerecordrV always_copy multi_versionrdno_deps allow_hostsrootprefix no_reportrkinstall_purelibinstall_platlibinstall_headers install_libinstall_scripts install_data install_baseinstall_platbasesiteENABLE_USER_SITE USER_BASEinstall_userbase USER_SITEinstall_usersite no_find_links package_indexpth_filealways_copy_from site_dirsinstalled_projects_dry_run distributionverbose_set_command_optionsget_option_dictselfr7r7r8initialize_optionssN      zeasy_install.initialize_optionscCs"dd|D}tt|j|dS)Ncss,|]}tj|stj|r|VqdSN)r;r<r=islink).0filenamer7r7r8 s   z/easy_install.delete_blockers..)listmap _delete_path)rblockersZextant_blockersr7r7r8delete_blockersszeasy_install.delete_blockerscCsJtd||jr dStj|otj| }|rtntj}||dS)Nz Deleting %s) r infodry_runr;r<isdirrrmtreeunlink)rr<Zis_treeZremoverr7r7r8rs  zeasy_install._delete_pathcCs4djtj}td}d}t|jditt)zT Render the Setuptools version and installation details, then exit. {}.{} setuptoolsz=setuptools {dist.version} from {dist.location} (Python {ver})Nr7)formatsys version_infor!printlocals SystemExit)verdisttmplr7r7r8_render_versions zeasy_install._render_versionc Csl|jo|tjd}tdd\}}|j|j|j||dd|d|d||||t tddd |_ t j rK|j |j d <|j|j d <n|jrStd ||||d d dd|jdurp|j|_|jdurxd|_|dd|dd|jr|jr|j|_|j|_|ddtttj}t|_ |j!durdd|j!dD}|D]#}t"j#|std|qt||vrt$|d|j %t|q|j&s|'|j(pd|_(|j dd|_)|jt|jfD]}||j)vr|j)*d|q|j+durdd|j+dD}ndg}|j,dur+|j-|j(|j)|d|_,t.|j)tj|_/|j0durHt1|j0t2rG|j0|_0ng|_0|j3rY|j,4|j)tj|jsd|j,5|j0|dd t1|j6t7szt7|j6|_6d|j6krdkst8t8Wnt8y} zt$d!| d} ~ ww|j&r|j9st:d"|j;st:d#g|_-sz1easy_install.finalize_options..,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.org/simple/cSsg|]}|qSr7)rNrr7r7r8rC*) search_pathhosts)ryryz--optimize must be 0, 1, or 2z9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))=rkrrsplitrrget_name get_version get_fullnamegetattr config_varsrrrrrlr rn_fix_install_dir_for_user_siteexpand_basedirs expand_dirs_expandrsrrrset_undefined_optionsrrrrr< get_site_dirs all_site_dirsrr;rrappendrdcheck_site_dirru shadow_pathinsertr~r create_indexr# local_indexrv isinstancestrrqZscan_egg_linksadd_find_linksryint ValueErrorrwrrxoutputs) rrrrr?rrX path_itemrrer7r7r8finalize_optionss                        zeasy_install.finalize_optionscCs\|jrtjsdS||jdurd}t||j|_|_tj ddd}| |dS)z; Fix the install_dir if "--user" was used. Nz$User base directory is not specifiedposixunix_user) rlrrcreate_home_pathrr rrr;namerO select_scheme)rmsg scheme_namer7r7r8rjs  z+easy_install._fix_install_dir_for_user_sitecCsX|D]'}t||}|dur)tjdkstjdkrtj|}t||j}t|||qdS)Nrnt)rr;rr<rrrsetattr)rattrsattrvalr7r7r8 _expand_attrsys    zeasy_install._expand_attrscCs|gddS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.)rrrNrrr7r7r8rszeasy_install.expand_basedirscCsgd}||dS)z+Calls `os.path.expanduser` on install dirs.)rrrrrrNr)rdirsr7r7r8rszeasy_install.expand_dirsc Cs|r |dtj|j|jjkrt|jzQ|jD] }|||j q|j rZ|j }|j rFt |j }t t |D] }|||d||<q9ddlm}||j|j |fd|j |Wt|jjdSt|jjw)NzXWARNING: The easy_install command is deprecated and will be removed in a future version.r) file_utilz'writing list of installed files to '%s')announcer WARNrr set_verbosityrxr/r}rzrrlenrange distutilsrexecute write_filewarn_deprecated_options)rZshow_deprecationspecrroot_lencounterrr7r7r8runs2      "zeasy_install.runcCsBzt}Wntytdtj}Ynwtj|j d|S)zReturn a pseudo-tempname base in the install directory. This code is intentionally naive; if a malicious party can write to the target directory you're already in deep doodoo. rztest-easy-install-%s) r;getpid Exceptionrandomrandintrmaxsizer<joinrr)rpidr7r7r8pseudo_tempnames   zeasy_install.pseudo_tempnamecCdSrr7rr7r7r8rz$easy_install.warn_deprecated_optionsc CsBt|j}tj|d}tj|s)zt|Wnttfy(| Ynw||j v}|s8|j s8| }n1| d}tj|}z|rLt|t|dt|Wnttfyh| Ynw|s~|j s~tjdd}t|j|j||r|jdurt||j |_nd|_|j rtj|sd|_||_dS)z;Verify that self.install_dir is .pth-capable dir, if neededeasy-install.pthz .write-testw PYTHONPATHrN)rrrr;r<rr=makedirsOSErrorIOErrorcant_write_to_targetrr|check_pth_processingrropencloseenvirongetr rn_easy_install__no_default_msgrr0)rinstdirrZ is_site_dirZtestfileZ test_exists pythonpathr7r7r8rs@             zeasy_install.check_site_diraS can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: %s The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s z This directory does not currently exist. Please create it and try again, or choose a different installation directory (using the -d or --install-dir option). a Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.readthedocs.io/en/latest/deprecated/easy_install.html Please make the appropriate changes for your system and try again. cCsR|jtd|jf}tj|js|d|j7}t ||d|j7}t |)NrK) _easy_install__cant_write_msgrexc_inforrr;r<r=_easy_install__not_exists_id_easy_install__access_msgr)rrr7r7r8rs z!easy_install.cant_write_to_targetc Cs|j}td||d}|d}tj|}tdd}z|r't|tj |}tj |ddt |d}Wnt t fyI|Ynwz||jdit|d }tj}tjd krtj|\}} tj|d } | d kotj| } | r| }d dlm} | |dddgd tj|rtd|W|r|tj|rt|tj|rt|dSdSW|r|tj|rt|tj|rt|n|r|tj|rt|tj|rt|ww|jstd|dS)z@Empirically verify whether .pth files are supported in inst. dirz Checking .pth file support in %s.pthz.okzz import os f = open({ok_file!r}, 'w') f.write('OK') f.close() rKT)exist_okrNr pythonw.exe python.exer)spawnz-Ez-cpassz-TEST PASSED: %s appears to support .pth filesz+TEST FAILED: %s does NOT support .pth filesFr7)rrr rrr;r<r=rQrdirnamerrrrrwriterrrr executablerrrlowerdistutils.spawnr-r|rn) rr"rZok_fileZ ok_existsrr/r^r1basenameZaltZuse_altr-r7r7r8rs~                       z!easy_install.check_pth_processingc CsV|js$|dr$|dD]}|d|rq ||||d|q ||dS)z=Write all the scripts for `dist`, unless scripts are excludedscriptszscripts/N)rtmetadata_isdirmetadata_listdirinstall_script get_metadatainstall_wrapper_scripts)rr script_namer7r7r8install_egg_scriptsSs z easy_install.install_egg_scriptscCsVtj|r#t|D]\}}}|D] }|jtj||qq dS|j|dSr)r;r<rwalkrrr)rr<baserfilesrr7r7r8 add_outputas zeasy_install.add_outputcCs|jr td|fdS)NzjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).)rdrrrr7r7r8 not_editableiszeasy_install.not_editablecCs<|jsdStjtj|j|jrtd|j|jfdS)Nz2%r already exists in %s; can't do a checkout there)rdr;r<r=rrwkeyrrAr7r7r8check_editableqs zeasy_install.check_editablec csTtjdd}zt|VWtj|ot|dSdStj|o(t|ww)Nz easy_install-)r)tempfilemkdtemprr;r<r=r)rtmpdirr7r7r8_tmpdir{s   8zeasy_install._tmpdirFc CsB|}t|tsIt|r*|||j||}|d|||dWdStj |rE|||d|||dWdSt |}| ||j |||j|j|j |j}|durqd|}|jrm|d7}t||jtkr||||d|WdS|||j||WdS1swYdS)NTz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)Using)rHrr$rrBrdownload install_itemr;r<r=rrDZfetch_distributionrVrdr{rr precedencer+process_distributionlocation)rrdepsrGdlrrr7r7r8r/s8         $zeasy_install.easy_installcCs |p|j}|ptj||k}|p|d }|p*|jduo*tjt|t|jk}|rA|sA|j|jD] }|j |kr>nq5d}t dtj ||ra| |||}|D] }||||qVn||g}|||d|d|dur|D] }||vr|SqwdSdS)N.eggTz Processing %srrI)r{r;r<r/endswithrrr project_namerNr rr4 install_eggsrMegg_distribution)rrrJrGrOZinstall_neededrdistsr7r7r8rKs<    zeasy_install.install_itemcCs<t|}tD]}d|}t||durt||||qdS)z=Sets the install directories by applying the install schemes.install_N)r r rr)rrschemerCattrnamer7r7r8rszeasy_install.select_schemec Gs|||j|||j|jvr|j||j|||||j|j<t |j ||g|R| drH|j sH|j |d|sO|jsOdS|dura|j|jkratd|dS|dusi||vrs|}tt|}t d|ztg|g|j|j}Wn%ty}ztt||d}~wty}zt||d}~ww|js|jr|D]}|j|jvr||qt d|dS)Nzdependency_links.txtzSkipping dependencies for %szProcessing dependencies for %sz'Finished processing dependencies for %s) update_pthraddrrCremover<rr rinstallation_report has_metadatarrget_metadata_linesr{rnas_requirementr$rr(resolver/r)rr*reportr)r requirementrrOrZdistreqZdistrosrer7r7r8rMsP              z!easy_install.process_distributioncCs2|jdur |j S|drdS|dsdSdS)Nz not-zip-safeTzzip-safeF)rpr^rrr7r7r8 should_unzips   zeasy_install.should_unzipcCstj|j|j}tj|rd}t||j|j||Stj|r&|}n)tj ||kr3t |t |}t |dkrOtj||d}tj|rO|}t |t|||S)Nz<%r already exists in %s; build directory %s will not be keptr$r)r;r<rrwrCr=r rnrr/rlistdirrr shutilmove)rr dist_filename setup_basedstrcontentsr7r7r8 maybe_moves$       zeasy_install.maybe_movecCs,|jrdSt|D]}|j|q dSr)rt ScriptWriterbestget_args write_script)rrrxr7r7r8r:s  z$easy_install.install_wrapper_scriptscCsNt|}t||}|r||t}t||}||t|ddS)z/Generate a legacy script wrapper and install itr_N) rr`is_python_script_load_templaterrn get_headerrqrG)rrr; script_textdev_pathrZ is_scriptbodyr7r7r8r8"s  zeasy_install.install_scriptcCs(d}|r |dd}td|}|dS)z There are a couple of template scripts in the package. This function loads one of them and prepares it for use. z script.tmplz.tmplz (dev).tmplrutf-8)rOrdecode)rvrZ raw_bytesr7r7r8rs,s    zeasy_install._load_templatetr7csfdd|Dtd|jtjj|}|jr&dSt }t |tj |r8t |t |d| }||Wdn1sOwYt|d|dS)z1Write an executable file to the scripts directorycsg|] }tjj|qSr7)r;r<rrsrrZrr7r8r>z-easy_install.write_script..zInstalling %s script to %sNri)rr rrsr;r<rr@r current_umaskr r=rrr0chmod)rr;rlmodertargetmaskr^r7rr8rq;s     zeasy_install.write_scriptc CsH|j|j|jd}z ||dd}Wn tyYnw|||gS|}tj|r:|ds:t |||j n tj |rFtj |}| |rY|jrY|durY||||}tj|d}tj|sttj|dd}|s|tdtj |t|dkrtdtj ||d }|jrt|||gS|||S) N)rQ.exez.whl.pyzsetup.pyrz"Couldn't find a setup script in %sr$zMultiple setup scripts in %sr) install_egg install_exe install_wheelr2KeyErrorr;r<isfilerRrunpack_progressrabspath startswithrwrmrr=rrrrdr rreport_editablebuild_and_install) rrrirGZ installer_mapZ install_distrj setup_scriptZsetupsr7r7r8rTOsT          zeasy_install.install_eggscCs>tj|rt|tj|d}ntt|}tj ||dS)NEGG-INFO)metadata) r;r<rr&rr' zipimport zipimporterr% from_filename)regg_pathrr7r7r8rUs  zeasy_install.egg_distributionc Cstj|jtj|}tj|}|jst|||}t ||stj |r8tj |s8t j ||jdntj|rI|tj|fd|z_d}tj |re||r^tjd}}n,tjd}}n%||rv|||jd}}nd}||rtjd}}ntjd}}||||f|dtj|tj|ft||d Wntyt|dd w||||S) Nr Removing FZMovingZCopyingZ ExtractingTz %s to %sfix_zipimporter_caches)r;r<rrrr4rrr rUr.rrr remove_treer=rrrrgrhcopytreeremkpathunpack_and_compilecopy2r/update_dist_cachesr r@)rrrG destinationrZnew_dist_is_zippedr^rUr7r7r8rs`                 zeasy_install.install_eggc sNt|}|durtd|td|dd|ddtd}tj||d}||_ |d}tj|d}tj|d }t |t |||_ | ||tj|st|d } | d |dD]\} } | d kr{| d | dd| fqd| tj|d|fddt|Dtj|||j|jd|||S)Nz(%s is not a valid distutils Windows .exerrrk)rSrkplatformrQz.tmprPKG-INFOrzMetadata-Version: 1.0 target_versionz%s: %s _-r5csg|] }tj|dqS)r)r;r<r)rrxrsr7r8rsz,easy_install.install_exe..)rr)r1rr%r rr;r<regg_namerNr r& _provider exe_to_eggr=rr0itemsrOtitlerrrnrpr make_zipfilerrr) rrirGcfgrregg_tmpZ _egg_infoZpkg_infr^kvr7rr8rsD        zeasy_install.install_exec s8t|ggifdd}t||g}D]7}|drU|d}|d}t|dd|d<tjj g|R} || |t ||q| t tj dt|dD]-} t| rtj d| d } tj| st| d } | d t| d | qld S) z;Extract a bdist_wininst to the directories an egg would usecs|}D]l\}}||rr||t|d}|d}tjjg|R}|}|ds6|drTt |d|d<dtj |dd< ||S|drn|dkrndtj |dd< ||Sq|d s~t d |dS) N/.pyd.dllr$rrSCRIPTS/r)zWARNING: can't process %s)r2rrrr;r<rrRr strip_modulesplitextrr rn)srcrkrFoldnewpartsrPr native_libsprefixes to_compile top_levelr7r8processs(      z(easy_install.exe_to_egg..processrrrrr)rrz.txtrrKN)r2rr2rRrrrr;r<rrZ write_stub byte_compileZwrite_safety_flagZ analyze_eggrr=rr0r) rrirrZstubsresrresourceZpyfilertxtr^r7rr8rs>           zeasy_install.exe_to_eggc Cst|}|s Jtj|j|}tj|}|js!t |tj |r6tj |s6t j ||jdntj|rG|tj|fd|z||j|fdtj|tj|fWt|ddnt|ddw||||S)NrrzInstalling %s to %sFr)r is_compatibler;r<rrrrrrr rrr rr=rrZinstall_as_eggr4r/rr@rU)r wheel_pathrGwheelrr7r7r8r$s4       zeasy_install.install_wheela( Because this distribution was installed --multi-version, before you can import modules from this package in an application, you will need to 'import pkg_resources' and then use a 'require()' call similar to one of these examples, in order to select the desired version: pkg_resources.require("%(name)s") # latest installed version pkg_resources.require("%(name)s==%(version)s") # this exact version pkg_resources.require("%(name)s>=%(version)s") # this version or higher z Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) Installedc Cs^d}|jr|js|d|j7}|jtttjvr|d|j7}|j }|j }|j }d}|t S)z9Helpful installation message for display to package usersz %(what)s %(eggloc)s%(extras)srKr) r|r_easy_install__mv_warningrrrrrr<_easy_install__id_warningrNrSrkr) rreqrwhatrZegglocrrkextrasr7r7r8r]Rs  z easy_install.installation_reportaR Extracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. cCs"tj|}tj}d|jtS)NrK)r;r<r/rr1_easy_install__editable_msgr)rrrr/pythonr7r7r8rks zeasy_install.report_editablec Cstjdttjdtt|}|jdkr'd|jd}|dd|n |jdkr2|dd|jr;|dd t d |t |ddd |zt ||WdStyl}z td |jdf|d}~ww) Nzdistutils.command.bdist_eggzdistutils.command.egg_inforrr$rrz-qz-nz Running %s %s zSetup script exited with %s)rmodules setdefaultrrrrrrr rrrrrrrx)rrrjrxrr7r7r8rps.    zeasy_install.run_setupc Csddg}tjdtj|d}zJ|tj|||||||t|g}g}|D]}||D] }|| |j |q4q.|sM|j sMt d||Wt|t |jSt|t |jw)Nrz --dist-dirz egg-dist-tmp-)rdirz+No eggs found in %s (setup script problem?))rErFr;r<r/_set_fetcher_optionsrrr#rrNrr rnrrr) rrrjrxdist_dirZall_eggseggsrCrr7r7r8rs.     zeasy_install.build_and_installc Csh|jd}d}i}|D]\}}||vrq|d||<qt|d}tj|d}t ||dS)a When easy_install is about to run bdist_egg on a source dist, that source dist might have 'setup_requires' directives, requiring additional fetching. Ensure the fetcher options given to easy_install are available to that command as well. r/)rvrruryr~r$)r/z setup.cfgN) rrcopyrdictr;r<rrZ edit_config) rr>Zei_optsZfetch_directivesZ fetch_optionsrCrsettingsZ cfg_filenamer7r7r8rs  z!easy_install._set_fetcher_optionscCsJ|jdurdS|j|jD]%}|js|j|jkrq td||j||j|jvr2|j|jq |js]|j|jjvrDtd|ntd||j ||j|jvr]|j |j|j rbdS|j |jdkrndSt j|jd}t j|rt |t|d}||j|jdWddS1swYdS)Nz&Removing %s from easy-install.pth filez4%s is already the active version in easy-install.pthz"Adding %s to easy-install.pth filersetuptools.pthwtrK)rrCr|rNr rr\rpathsr[rrsaver;r<rrrrrrr0 make_relative)rrrXrr^r7r7r8rZs>            "zeasy_install.update_pthcCstd|||S)NzUnpacking %s to %s)r debug)rrrkr7r7r8rszeasy_install.unpack_progresscshggfdd}t|||js0D]}t|tjdBd@}t||qdSdS)NcsZ|dr|ds|n|ds|dr|||j r+|p,dS)Nr EGG-INFO/rz.so)rRrrrr)rrkrZto_chmodrr7r8pfs    z+easy_install.unpack_and_compile..pfimi)rrrr;statST_MODEr~)rrrrr^rr7rr8rs   zeasy_install.unpack_and_compilec CstjrdSddlm}z0t|jd||dd|jd|jr3|||jd|jdWt|jdSWt|jdSt|jw)Nr)rr$)ryforcer) rdont_write_bytecodedistutils.utilrr rrrry)rrrr7r7r8rs zeasy_install.byte_compilea bad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: https://setuptools.readthedocs.io/en/latest/deprecated/easy_install.html#custom-installation-locations Please make the appropriate changes for your system and try again. cCsb|jsdSttjd}|jD]\}}||r.tj|s.| d|t |dqdS)zCreate directories under ~.N~zos.makedirs('%s', 0o700)i) rlrr;r<rrrrr debug_printr)rhomerr<r7r7r8r)s zeasy_install.create_home_pathz/$base/lib/python$py_version_short/site-packagesz $base/binrrz$base/Lib/site-packagesz $base/ScriptscGs|dj}|jr2|}|j|d<|jtj|j}| D]\}}t ||ddur1t |||qddl m }|D]!}t ||}|dur[|||}tjdkrUtj|}t |||q:dS)Nrr>r)rr)get_finalized_commandrrrr r r;rDEFAULT_SCHEMErrrrrr<r)rrrrXrrrr7r7r8r?s&         zeasy_install._expand)T)Fr)rzr7)r)M__name__ __module__ __qualname____doc__ descriptionZcommand_consumes_argumentsrr user_optionsboolean_options negative_optrrrrr staticmethodrrrrrrr rrrrLrMlstripr%r'r(rrr<r@rBrD contextlibcontextmanagerrHr/rKrrMrermr:r8rsrqrTrUrrrrrrr]rrrrrrZrrrrNr!rrr rrr7r7r7r8r/ns5     -  ;   !$ )    3 6.5    )   r/cCs tjddtj}td|S)Nrr)r;rr rpathsepfilter)rr7r7r8 _pythonpathVs rc sgttjg}tjtjkr|tj|D]h}|sqtjdvr0tj |ddn+tj dkrNtj |ddj tj dtj |ddgn |tj |ddgtjdkraqd |vrfqtj d }|soqtj |d d d j tj d}|qtdtdf}fdd|DtjrtjtttWdn1swYtttS)z& Return a list of 'site' dirs )Zos2emxZriscosLibz site-packagesrlibz python{}.{}z site-pythondarwinzPython.frameworkHOMELibraryPythonrpurelibplatlibc3s|] }|vr|VqdSrr7rsitedirsr7r8rsz get_site_dirs..N)extendrrrrrrr;r<rseprrrr rrrrrsuppressAttributeErrorgetsitepackagesrrr)rrrZhome_spZ lib_pathsr7rr8r[s`             rccsi}|D]l}t|}||vrqd||<tj|sqt|}||fV|D]I}|ds/q'|dvr4q'ttj||}tt |}| |D]&}| drQqIt| }||vr\qId||<tj|sgqI|t|fVqIq'qdS)zBYield sys.path directories that might contain "old-style" packagesr$r))rrimportN) rr;r<rrfrRrrrrrrrstrip)inputsseenr/r?rr^linesliner7r7r8 expand_pathss@        rc CsTt|d}zt|}|durW|dS|d|d|d}|dkr-W|dS||dtd|d\}}}|dvrKW|dS||d|d d d }t |}z||} | d d d } | t } |t| WntjyYW|dSw|dr|dsW|dS|W|S|w)znExtract configuration data from a bdist_wininst .exe Returns a configparser.RawConfigParser, or None rbN  zegg path translations for a given .exe file))zPURELIB/r)zPLATLIB/pywin32_system32r)zPLATLIB/r)rzEGG-INFO/scripts/)zDATA/lib/site-packagesrrrrrr$z .egg-inforNrr)z -nspkg.pth)ZPURELIBZPLATLIB\r z%s/%s/rcSsg|] \}}||fqSr7)r2)rrZyr7r7r8rr|z$get_exe_prefixes..)rZipFileinfolistrrrrRrrupperrryrrNrOrrrsortreverse)Z exe_filenamerrSrrrrlpthr7r7r8r2s4      r2c@sReZdZdZdZdddZddZdd Zed d Z d d Z ddZ ddZ dS)r0z)A .pth file with Distribution paths in itFr7cCsl||_ttt||_ttj|j|_| t |gddt |j D] }tt|jt|dq&dS)NT)rrrrrr;r<r/basedir_loadr#__init__rrr[r")rrrr<r7r7r8r7"szPthDistributions.__init__cCsg|_d}t|j}tj|jret|jd}|D]F}| dr$d}q| }|j || r9| dr:qt tj|j|}|jd<tj|rS||vr\|jd|_qd||<q||jrm|smd|_|jr|jd s|j|jr|jd rwdSdSdSdS)NFrtr T#rr$)rrfromkeysrr;r<rrrrrrrNrrr5r=popdirtyr)rZ saw_importrr^rr<r7r7r8r6+s6        $zPthDistributions._loadcCs|jsdStt|j|j}|rLtd|j||}d |d}t j |jr0t |jt|jd }||Wdn1sFwYnt j |jr`td|jt |jd|_dS)z$Write changed .pth file back to diskNz Saving %srKrzDeleting empty %sF)r<rrrrr rr _wrap_linesrr;r<rrrr0r=)rZ rel_pathsrdatar^r7r7r8rJs"     zPthDistributions.savecC|Srr7)rr7r7r8r=`szPthDistributions._wrap_linescCsN|j|jvo|j|jvp|jtk}|r|j|jd|_t||dS)z"Add `dist` to the distribution mapTN) rNrrr;getcwdrr<r#r[)rrnew_pathr7r7r8r[ds   zPthDistributions.addcCs<|j|jvr|j|jd|_|j|jvst||dS)z'Remove `dist` from the distribution mapTN)rNrr\r<r#rdr7r7r8r\rs  zPthDistributions.removecCstjt|\}}t|j}|g}tjdkrdptj}t||krI||jkr6|tj | | |Stj|\}}||t||ks"|S)Nr) r;r<rrrr5altsepr rcurdirr3r)rr<npathlastZbaselenrr r7r7r8rys       zPthDistributions.make_relativeN)r7) rrrrr<r7r6rrr=r[r\rr7r7r7r8r0s    r0c@s(eZdZeddZedZedZdS)RewritePthDistributionsccs&|jV|D]}|Vq|jVdSr)preludepostlude)clsrrr7r7r8r=s  z#RewritePthDistributions._wrap_linesz? import sys sys.__plen = len(sys.path) z import sys new = sys.path[sys.__plen:] del sys.path[sys.__plen:] p = getattr(sys, '__egginsert', 0) sys.path[p:p] = new sys.__egginsert = p + len(new) N)rrr classmethodr=rQrGrHr7r7r7r8rFs   rFZSETUPTOOLS_SYS_PATH_TECHNIQUErawZrewritecCs ttjtrtSttjS)z_ Return a regular expression based on first_line_re suitable for matching strings. )rrpatternrrecompileryr7r7r7r8_first_line_res rOcCsX|tjtjfvrtjdkrt|tj||St\}}}|d|dd||ff)Nrrr$z %s %s) r;rr\rr~rS_IWRITErr&)funcargexcetZevrr7r7r8 auto_chmods  rUcCs0t|}t|tj|rt|dSt|dS)aa Fix any globally cached `dist_path` related data `dist_path` should be a path of a newly installed egg distribution (zipped or unzipped). sys.path_importer_cache contains finder objects that have been cached when importing data from the original distribution. Any such finders need to be cleared since the replacement distribution might be packaged differently, e.g. a zipped egg distribution might get replaced with an unzipped egg folder or vice versa. Having the old finders cached may then cause Python to attempt loading modules from the replacement distribution using an incorrect loader. zipimport.zipimporter objects are Python loaders charged with importing data packaged inside zip archives. If stale loaders referencing the original distribution, are left behind, they can fail to load modules from the replacement distribution. E.g. if an old zipimport.zipimporter instance is used to load data from a new zipped egg archive, it may cause the operation to attempt to locate the requested data in the wrong location - one indicated by the original distribution's zip archive directory information. Such an operation may then fail outright, e.g. report having read a 'bad local file header', or even worse, it may fail silently & return invalid data. zipimport._zip_directory_cache contains cached zip archive directory information for all existing zipimport.zipimporter instances and all such instances connected to the same archive share the same cached directory information. If asked, and the underlying Python implementation allows it, we can fix all existing zipimport.zipimporter instances instead of having to track them down and remove them one by one, by updating their shared cached zip archive directory information. This, of course, assumes that the replacement distribution is packaged as a zipped egg. If not asked to fix existing zipimport.zipimporter instances, we still do our best to clear any remaining zipimport.zipimporter related cached data that might somehow later get used when attempting to load data from the new distribution and thus cause such load operations to fail. Note that when tracking down such remaining stale data, we can not catch every conceivable usage from here, and we clear only those that we know of and have found to cause problems if left alive. Any remaining caches should be updated by whomever is in charge of maintaining them, i.e. they should be ready to handle us replacing their zip archives with new distributions at runtime. N)r_uncacherpath_importer_cache!_replace_zip_directory_cache_data*_remove_and_clear_zip_directory_cache_data) dist_pathrnormalized_pathr7r7r8rs <   rcCsPg}t|}|D]}t|}||r%|||dtjdfvr%||q|S)ap Return zipimporter cache entry keys related to a given normalized path. Alternative path spellings (e.g. those using different character case or those using alternative path separators) related to the same path are included. Any sub-path entries are included as well, i.e. those corresponding to zip archives embedded in other zip archives. r$r)rrrr;r r)r[cacheresult prefix_lenpnpr7r7r8"_collect_zipimporter_cache_entries s   racCs@t||D]}||}||=|o|||}|dur|||<qdS)a Update zipimporter cache data for a given normalized path. Any sub-path entries are processed as well, i.e. those corresponding to zip archives embedded in other zip archives. Given updater is a callable taking a cache entry key and the original entry (after already removing the entry from the cache), and expected to update the entry and possibly return a new one to be inserted in its place. Returning None indicates that the entry should not be replaced with a new one. If no updater is given, the cache entries are simply removed without any additional processing, the same as if the updater simply returned None. N)ra)r[r\updaterr_ old_entryZ new_entryr7r7r8_update_zipimporter_caches rdcCst||dSr)rd)r[r\r7r7r8rV>r:rVcCdd}t|tj|ddS)NcSs |dSr)clearr<rcr7r7r82clear_and_remove_cached_zip_archive_directory_dataCs zf_remove_and_clear_zip_directory_cache_data..clear_and_remove_cached_zip_archive_directory_datarbrdr_zip_directory_cache)r[rhr7r7r8rYBs  rYZ__pypy__cCre)NcSs&|t||tj||Sr)rfrrupdaterkrgr7r7r8)replace_cached_zip_archive_directory_dataYs zT_replace_zip_directory_cache_data..replace_cached_zip_archive_directory_datarirj)r[rmr7r7r8rXXs   rXc Cs,z t||dWdSttfyYdSw)z%Is this string a valid Python script?execFT)rN SyntaxError TypeError)rPrr7r7r8 is_pythonks rrc Cshz&tj|dd }|d}Wdn 1swYW|dkSW|dkSttfy3|YSw)zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)encodingrN#!)r$rrrr)r1fpmagicr7r7r8is_shus rwcCs t|gS)z@Quote a command line argument according to Windows parsing rules subprocess list2cmdline)rRr7r7r8 nt_quote_args r{cCsH|ds |dr dSt||rdS|dr"d|dvSdS)zMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. r.pywTrtrrF)rRrrr splitlinesr2)rurr7r7r8rrs  rr)r~cGrrr7)rxr7r7r8_chmodrr~c CsTtd||zt||WdStjy)}z td|WYd}~dSd}~ww)Nzchanging mode of %s to %ozchmod failed: %s)r rr~r;error)r<rrer7r7r8r~sr~c@seZdZdZgZeZeddZeddZ eddZ edd Z ed d Z d d Z eddZddZeddZeddZdS) CommandSpeczm A command spec for a #! header, specified as a list of arguments akin to those passed to Popen. cCr?)zV Choose the best CommandSpec class based on environmental conditions. r7rIr7r7r8roszCommandSpec.bestcCstjtj}tjd|S)N__PYVENV_LAUNCHER__)r;r<r?rr1rr )rI_defaultr7r7r8_sys_executableszCommandSpec._sys_executablecCs:t||r|St|tr||S|dur|S||S)zg Construct a CommandSpec from a parameter to build_scripts, which may be None. N)rrfrom_environment from_string)rIparamr7r7r8 from_params   zCommandSpec.from_paramcCs||gSr)rrr7r7r8rszCommandSpec.from_environmentcCstj|fi|j}||S)z} Construct a command spec from a simple string representing a command line parseable by shlex.split. )shlexr split_args)rIstringrr7r7r8rszCommandSpec.from_stringcCs<t|||_t|}t|sdg|jdd<dSdS)Nz-xr)rr_extract_optionsoptionsryrzrJ)rrucmdliner7r7r8install_optionss  zCommandSpec.install_optionscCs:|dd}t|}|r|dpdnd}|S)zH Extract any options from the first line of the script. rKrr$r)r}rOmatchgrouprN)Z orig_scriptfirstrrr7r7r8rs  zCommandSpec._extract_optionscCs||t|jSr)_renderrrrr7r7r8 as_headerszCommandSpec.as_headercCs6d}|D]}||r||r|ddSq|S)Nz"'r$r)rrR)itemZ_QUOTESqr7r7r8 _strip_quotess zCommandSpec._strip_quotescCs tdd|D}d|dS)Ncss|] }t|VqdSr)rrrN)rrr7r7r8rs z&CommandSpec._render..rtrKrx)rrr7r7r8rs  zCommandSpec._renderN)rrrrrrrrJrorrrrrrrrrrr7r7r7r8rs,        rc@seZdZeddZdS)WindowsCommandSpecFrN)rrrrrr7r7r7r8rsrc@seZdZdZedZeZ e dddZ e dddZ e dd d Z ed d Ze d dZe ddZe ddZe dddZdS)rnz` Encapsulates behavior around writing entry point scripts for console and gui apps. aJ # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r import re import sys # for compatibility with easy_install; see #2198 __requires__ = %(spec)r try: from importlib.metadata import distribution except ImportError: try: from importlib_metadata import distribution except ImportError: from pkg_resources import load_entry_point def importlib_load_entry_point(spec, group, name): dist_name, _, _ = spec.partition('==') matches = ( entry_point for entry_point in distribution(dist_name).entry_points if entry_point.group == group and entry_point.name == name ) return next(matches).load() globals().setdefault('load_entry_point', importlib_load_entry_point) if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(load_entry_point(%(spec)r, %(group)r, %(name)r)()) NFcCs6tdt|r tnt}|d||}|||S)Nz Use get_argsr)rmrnroWindowsScriptWriterrnroget_script_headerrp)rIrr1wininstwriterheaderr7r7r8get_script_args(s  zScriptWriter.get_script_argscCs$tjdtdd|r d}|||S)NzUse get_headerr) stacklevelr,)rmrnrort)rIrur1rr7r7r8r0s  zScriptWriter.get_script_headerc cs|dur |}t|}dD]-}|d}||D]\}}|||jt}|||||} | D]} | Vq7qqdS)z Yield write_script() argument tuples for a distribution's console_scripts and gui_scripts entry points. NconsoleguiZ_scripts) rtrr` get_entry_mapr_ensure_safe_nametemplater_get_script_args) rIrrrtype_rreprurxrr7r7r8rp9s   zScriptWriter.get_argscCstd|}|r tddS)z? Prevent paths in *_scripts entry point names. z[\\/]z+Path separators not allowed in script namesN)rMsearchr)rZ has_path_sepr7r7r8rKs zScriptWriter._ensure_safe_namecCs tdt|r tS|SNzUse best)rmrnrorro)rIZ force_windowsr7r7r8 get_writerTs zScriptWriter.get_writercCs*tjdkstjdkrtjdkrtS|S)zD Select the best ScriptWriter for this environment. win32javar)rrr;r_namerrorr7r7r8roZszScriptWriter.bestccs|||fVdSrr7)rIrrrrur7r7r8rdszScriptWriter._get_script_argsrcCs"|j|}|||S)z;Create a #! line, getting options (if any) from script_text)command_spec_classrorrr)rIrur1cmdr7r7r8rtis zScriptWriter.get_header)NFr)rN)rrrrrLrMrrrrrJrrrprrrrorrtr7r7r7r8rns,!#       rnc@sLeZdZeZeddZeddZeddZeddZ e d d Z d S) rcCstdt|Sr)rmrnrororr7r7r8rts zWindowsScriptWriter.get_writercCs"tt|d}tjdd}||S)zC Select the best ScriptWriter suitable for Windows )r1ZnaturalZSETUPTOOLS_LAUNCHERr1)rWindowsExecutableLauncherWriterr;rr )rIZ writer_lookuplauncherr7r7r8rozs zWindowsScriptWriter.bestc #stddd|}|tjddvr$djd it}t|t gd}| || ||}fdd |D}|||d |fVd S) z For Windows, add a .py extension.pyar|rPATHEXT;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.)rr -script.py.pyc.pyor|rcg|]}|qSr7r7r{rr7r8rrz8WindowsScriptWriter._get_script_args..rzNr7) rr;rr2rrrrmrn UserWarningr\_adjust_header) rIrrrruextrrrr7rr8rs   z$WindowsScriptWriter._get_script_argscCsNd}d}|dkr ||}}tt|tj}|j||d}||r%|S|S)z Make sure 'pythonw' is used for gui and 'python' is used for console (regardless of what sys.executable is). r+r,r)rrepl)rMrNescape IGNORECASEsub _use_header)rIrZ orig_headerrLrZ pattern_ob new_headerr7r7r8rs z"WindowsScriptWriter._adjust_headercCs$|ddd}tjdkpt|S)z Should _adjust_header use the replaced header? On non-windows systems, always use. On Windows systems, only use the replaced header if it resolves to an executable on the system. rr"r)rNrrr)rZ clean_headerr7r7r8rs zWindowsScriptWriter._use_headerN) rrrrrrJrrorrrrr7r7r7r8rqs     rc@seZdZeddZdS)rc #s|dkr d}d}dg}nd}d}gd}|||}fdd|D} |||d | fVd t|d fVtsJd } | td fVd Sd S)zG For Windows, add a .py extension and an .exe launcher rz -script.pywr|clir)rrrcrr7r7r{rr7r8rrzDWindowsExecutableLauncherWriter._get_script_args..rzrr_z .exe.manifestN)rget_win_launcherr9load_launcher_manifest) rIrrrruZ launcher_typerrhdrrZm_namer7rr8rs$  z0WindowsExecutableLauncherWriter._get_script_argsN)rrrrJrr7r7r7r8rsrcCsJd|}trtdkr|dd}n |dd}n|dd}td|S)z Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. z%s.exez win-arm64.z-arm64.z-64.z-32.r)r9rrOr)typeZ launcher_fnr7r7r8rs   rcCsttd}|dtS)Nzlauncher manifest.xmlrx) pkg_resourcesrrryvars)rmanifestr7r7r8rs rFcCst|||Sr)rgr)r< ignore_errorsonerrorr7r7r8rr:rcCstd}t||S)N)r;umask)tmpr7r7r8r}s  r}c@seZdZdZdS)rozF Warning for EasyInstall deprecations, bypassing suppression. N)rrrrr7r7r7r8rosror)rn)|rrrrrrdistutils.errorsrrrr distutils.command.installr r rr r Zdistutils.command.build_scriptsrr3rrr;rrgrErrMrr rLrmrr5rryrr$r  sysconfigrrrrrZsetuptools.sandboxrZsetuptools.commandrZsetuptools.archive_utilrZsetuptools.package_indexrrrrrZsetuptools.wheelrrrrrr r!r"r#r$r%r&r'r(r)r*r+filterwarnings PEP440Warning__all__r9r.rGrJrQr/rrrr1r2r0rFrr rOrUrrardrVrYbuiltin_module_namesrXrrrwr{rrr~r~ ImportErrorrrrZsys_executablerrnrrrrrrrr}ror7r7r7r8s         DqF.)%l  R       TtA