o VD7hW@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)ka) 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.pypa.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)structcalcsizer7r7A/usr/lib/python3/dist-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)p1p2 both_exist use_samefilenorm_p1norm_p2r7r7r8r.Nsr.cCs |dS)Nutf8)encodesr7r7r8 _to_bytes^s rKcCs&z|dWdStyYdSw)NasciiTF)rH UnicodeErrorrIr7r7r8isasciibs   rNcCst|ddS)N z; )textwrapdedentstripreplace)textr7r7r8 _one_linerjsrUc@seZdZdZdZdZdddddd d d d d ddddddddddddddddejfgZgdZ dd iZ e Z d!d"Z d#d$Zd%d&Zed'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zdd3d4Zd5d6Zd7d8Zd9d:Zed;Zed<Zed=Z d>d?Z!d@dAZ"dBdCZ#dDdEZ$dFdGZ%dHdIZ&e'j(dJdKZ)ddMdNZ*ddOdPZ+dQdRZ, ddSdTZ-dUdVZ.dWdXZ/dYdZZ0dd[d\Z1ed]d^Z2ddadbZ3dcddZ4dedfZ5dgdhZ6didjZ7dkdlZ8dmdnZ9edoZ:edpZ;ddrdsZdwdxZ?dydzZ@d{d|ZAd}d~ZBddZCddZDddZEedFZGddZHeIjJdddvs:deIjKvr=dZLndZLeMeMdddeMdeLddeMdeLddeMdeLdddZNeMdddZOddZPdS)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=rJzinstall 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)zinstall-layout=Nz1installation layout to choose (known values: deb))z"force-installation-into-system-dir0zforce installation into /usr)z no-find-linksNz9Don't load find-links defined in packages being installeduserNz!install in user site-package '%s') rVrXr]rZr_rhrjrmroz&force-installation-into-system-diruserrerVcCsDtdtd|_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|_-d|_.d|_/d|_0|j1j2|_2|j13||j14ddS)NzVeasy_install command is deprecated. Use build and pip and other standards-based tools.rr/)5warningswarnEasyInstallDeprecationWarningrqzip_oklocal_snapshots_ok install_dir script_direxclude_scripts index_url find_linksbuild_directoryargsoptimizerecordrZ always_copy multi_versionrhno_deps allow_hostsrootprefix no_reportroinstall_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_projectsinstall_layout"force_installation_into_system_dir multiarch_dry_run distributionverbose_set_command_optionsget_option_dictselfr7r7r8initialize_optionssT      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)rblockersextant_blockersr7r7r8delete_blockersszeasy_install.delete_blockerscCsJtd||jr dStj|otj| }|rtntj}||dS)Nz Deleting %s) r infodry_runr;r<isdirrrmtreeunlink)rr<is_treeremoverr7r7r8rs  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 Cs|jo|tjd}tdd\}}|j|j|j||dd|d|d||||t tddd |_ t j rK|j |j d <|j|j d <n|jrStd ||||jr|jd vrmtd |j|_ddl}tjdddkr|d|_|dddd|jdur|j|_|jdurd|_| dd| dd|jr|j!r|j!|_|j"|_|j#dkr|j$std| ddt%t&tj'}t(|_)|j*dur dd|j*dD}|D]$}t+j',|std |qt&||vrt|d!|j)-t&|q|j.s|/|j0pd"|_0|j)dd|_1|jt&|jfD]}||j1vr;|j12d|q,|j3durOd#d|j3dD} nd$g} |j4durc|j5|j0|j1| d%|_4t6|j1tj'|_7|j8durt9|j8t:r|j8|_8ng|_8|j;r|j4<|j1tj'|js|j4=|j8| dd&t9|j>t?szt?|j>|_>d|j>krdkst@t@Wnt@y} ztd'| d} ~ ww|j.r|jAstBd(|jCstBd)g|_DdS)*Nrr exec_prefixabiflags) dist_name dist_version dist_fullname py_versionpy_version_shortpy_version_nodot sys_prefixrsys_exec_prefixrruserbaseusersitez6WARNING: The user site-packages directory is disabled.debz"unknown value for --install-layout)rr MULTIARCHrwrxr|rFr)rwrwrrwrx/usrzinstallation into /usr Trying to install into the system managed parts of the file system. Please consider to install to another location, or use the option --force-installation-into-system-dir to overwrite this warning. install)rrcSsg|] }tj|qSr7)r;r< expanduserrRrrJr7r7r8 Fsz1easy_install.finalize_options..,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.org/simple/cSsg|]}|qSr7)rRrr7r7r8r\*) search_pathhosts)r~r~z--optimize must be 0, 1, or 2z9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))Erorrsplitrrget_name get_version get_fullnamegetattr config_varsrrrrrqr rs_fix_install_dir_for_user_siteexpand_basedirs expand_dirsrlowerr sysconfigrget_config_varr_expandrxrwrset_undefined_optionsrrrrrrr< get_site_dirs all_site_dirsrr;rappendrhcheck_site_dirrz shadow_pathinsertrr create_indexr# local_indexr{ isinstancestrrvscan_egg_linksadd_find_linksr~int ValueErrorr|rr}outputs) rrrrrr?rr\ path_itemrrir7r7r8finalize_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) rqrrcreate_home_pathrr rrr;namerS select_scheme)rmsg scheme_namer7r7r8rs  z+easy_install._fix_install_dir_for_user_sitecCsX|D]'}t||}|dur)tjdkstjdkrtj|}t||j}t|||qdS)Nrnt)rr;rr<rrrsetattr)rattrsattrvalr7r7r8 _expand_attrss    zeasy_install._expand_attrscCs|gddS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.)rrrNr rr7r7r8rszeasy_install.expand_basedirscCsgd}||dS)z+Calls `os.path.expanduser` on install dirs.)rrrrrrNr)rdirsr7r7r8rszeasy_install.expand_dirsc Cs|r |dtj|j|jjkrt|jzU|jD] }|||j q|j r^t t |j }|j rJt|j }tt|D] }|||d||<q=ddlm}||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_verbosityr}r/rrrsortedrrlenrange distutilsrexecute write_filewarn_deprecated_options)rshow_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<joinrw)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)rrwr;r<r%r=makedirsOSErrorIOErrorcant_write_to_targetrrcheck_pth_processingr'ropencloseenvirongetr rs_easy_install__no_default_msgrr0)rinstdirr is_site_dirtestfile 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.pypa.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 |)NrO) _easy_install__cant_write_msgrexc_inforwr;r<r=_easy_install__not_exists_id_easy_install__access_msgr)rrr7r7r8r0(s 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() rOT)exist_okr+Nr pythonw.exe python.exer)spawnz-Ez-cpassz-TEST PASSED: %s appears to support .pth filesz+TEST FAILED: %s does NOT support .pth filesFr7)rwr rr'r;r<r=rUrdirnamer-r2r.r/r0writerrr3r executablerrr%rdistutils.spawnrErrs) rr7rok_file ok_existsrrGrbrIbasenamealtuse_altrEr7r7r8r11s~                       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)rymetadata_isdirmetadata_listdirinstall_script get_metadatainstall_wrapper_scripts)rr script_namer7r7r8install_egg_scriptsls z easy_install.install_egg_scriptscCsVtj|r#t|D]\}}}|D] }|jtj||qq dS|j|dSr)r;r<rwalkrrr%)rr<baserfilesrr7r7r8 add_outputzs 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).)rhrrrr7r7r8 not_editableszeasy_install.not_editablecCs<|jsdStjtj|j|jrtd|j|jfdS)Nz2%r already exists in %s; can't do a checkout there)rhr;r<r=r%r|keyrr\r7r7r8check_editables zeasy_install.check_editablec csTtjdd}zt|VWtj|ot|dSdStj|o(t|ww)Nz easy_install-)r)tempfilemkdtemprr;r<r=r)rtmpdirr7r7r8_tmpdirs   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)rcrr$rr]rdownload install_itemr;r<r=rr_fetch_distributionrZrhrrr precedencer+process_distributionlocation)rrdepsrbdlrrr7r7r8r/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 %srrd)rr;r<rGendswithrrr project_namerjr rrM install_eggsriegg_distribution)rrrerbrkinstall_neededrdistsr7r7r8rfs<    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 )rrschemer^attrnamer7r7r8rszeasy_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_pthraddrr^removerWrr rinstallation_report has_metadatarrget_metadata_linesrrsas_requirementr$rr(resolver/r)rr*reportr)r requirementrrkrdistreqdistrosrir7r7r8risP              z!easy_install.process_distributioncCs2|jdur |j S|drdS|dsdSdS)Nz not-zip-safeTzzip-safeF)rur{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<r%r|r^r=r rsrrGrlistdirrr shutilmove)rr dist_filename setup_basedstrcontentsr7r7r8 maybe_moves$       zeasy_install.maybe_movecCs,|jrdSt|D]}|j|q dSr)ry ScriptWriterbestget_args write_script)rrr}r7r7r8rU5s  z$easy_install.install_wrapper_scriptscCsNt|}t||}|r||t}t||}||t|ddS)z/Generate a legacy script wrapper and install itrcN) rr}is_python_script_load_templaterr get_headerrrK)rrrV script_textdev_pathr is_scriptbodyr7r7r8rS;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)rSrdecode)rr raw_bytesr7r7r8rEs    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<r%rxrr^rr7r8rWz-easy_install.write_script..zInstalling %s script to %sNr+i)rr rrxr;r<r%r[r current_umaskr r=rr2rHchmod)rrVrmodertargetmaskrbr7rr8rTs     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)rm.exez.whl.pyzsetup.pyrz"Couldn't find a setup script in %sr<zMultiple setup scripts in %sr) install_egg install_exe install_wheelrKeyErrorr;r<isfilernrunpack_progressrabspath startswithr|rr%r=rrrrhr rreport_editablebuild_and_install) rrrrb installer_map install_distr setup_scriptsetupsr7r7r8rphsT          zeasy_install.install_eggscCs>tj|rt|tj|d}ntt|}tj ||dS)NEGG-INFO)metadata) r;r<rr&r%r' zipimport zipimporterr% from_filename)regg_pathrr7r7r8rqs  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 FMovingCopying ExtractingTz %s to %sfix_zipimporter_caches)r;r<r%rwrMrrr rqr.rrr remove_treer=rrrrrcopytreermkpathunpack_and_compilecopy2rGupdate_dist_cachesr!r[)rrrb destinationrnew_dist_is_zippedrbrYr7r7r8rs`                 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 .exerrro)roroplatformrmz.tmprPKG-INFOr+zMetadata-Version: 1.0 target_versionz%s: %s _-rPcsg|] }tj|dqS)r)r;r<r%)rr}rxr7r8rsz,easy_install.install_exe..)rr)r1rr%r5rr;r<r%egg_namerjr r& _provider exe_to_eggr=r2rHitemsrStitler3rrrr make_zipfilerrr) rrrbcfgrregg_tmp _egg_infopkg_infrbkvr7rr8rsD        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/rAzWARNING: can't process %s)rrrrr;r<r%rnr strip_modulesplitextrr rs)srcrrJoldnewpartsrlr native_libsprefixes to_compile top_levelr7r8processs(      z(easy_install.exe_to_egg..processrrrrr)rrz.txtr+rON)r2rrrnrrrr;r<r%r write_stub byte_compilewrite_safety_flag analyze_eggrr=r2rHr3) rrrrstubsresrresourcepyfilertxtrbr7rr8rs>           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<r%rwrrrr rrr rr=rrinstall_as_eggrMrGrr[rq)r wheel_pathrbwheelrr7r7r8r=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)srOr) rr_easy_install__mv_warningrwrrrr<_easy_install__id_warningrjroror) rreqrwhatregglocrroextrasr7r7r8rzks  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)NrO)r;r<rGrrI_easy_install__editable_msgr)rrrrGpythonr7r7r8rs 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 rrr%rrrr})rrrr}rr7r7r8rs.    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?))r`rar;r<rG_set_fetcher_optionsrrr#rrjrr rsrrr) rrrr}dist_dirall_eggseggsr^rr7r7r8rs.     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/)r{rrzr~rr<)r/z setup.cfgN) rrcopyrdictr;r<r%r edit_config) rrYei_optsfetch_directives fetch_optionsr^r settings 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.pthwtrO)rr^rrjr rryrpathsrxrrsaver;r<r%rwrrr2rH make_relative)rrr\rrbr7r7r8rws>            "zeasy_install.update_pthcCstd|||S)NzUnpacking %s to %s)r debug)rrrr7r7r8rszeasy_install.unpack_progresscshggfdd}t|||js0D]}t|tjdBd@}t||qdSdS)NcsZ|dr|ds|n|ds|dr|||j r+|p,dS)Nr EGG-INFO/rz.so)rnrrrr)rrrto_chmodrr7r8pfs    z+easy_install.unpack_and_compile..pfimi)rrrr;statST_MODEr)rrrrrbrr7rr8rs   zeasy_install.unpack_and_compilec CstjrdSddlm}z0t|jd||dd|jd|jr3|||jd|jdWt|jdSWt|jdSt|jw)Nr)rr<)r~forcer) rdont_write_bytecodedistutils.utilrr rrrr~)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.pypa.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) rqrr;r<rrrrr debug_printr-)rhomerr<r7r7r8rBs zeasy_install.create_home_pathr)z2.3z2.4z2.5 real_prefix site-packages dist-packagesz/$base/lib/python$py_version_short/site-packagesz $base/binrz*$base/local/lib/python$py_version_short/%sz$base/local/binz$base/lib/python3/%s)r unix_local posix_local deb_systemz$base/Lib/site-packagesz $base/ScriptscGs|dj}|js |jrP|jr|jdvrd}d|_n|js"dtjvr&tj}nd}|}|j|d<|j ||j }| D]\}}t ||ddurOt|||q=dd lm}|D]!}t ||}|dury|||}tjd krstj|}t|||qXdS) Nrrr)rr$r(rYr)rr)get_finalized_commandrrrr__dict__r;rr r r5DEFAULT_SCHEMErrr r rr<r)rr rrrur r rr7r7r8ris2          zeasy_install._expand)T)Fr)rr7)r)Q__name__ __module__ __qualname____doc__ descriptioncommand_consumes_argumentsrr user_optionsboolean_options negative_optrrrrr staticmethodrrrr rrrr'rrrPrQlstripr=r?r@r0r1rWr[r]r_ contextlibcontextmanagerrcr/rfrrirrrUrSrrrprqrrrrrrrzrrrrrrwrrrrRr6rrror+ sitedir_namer r r,rr7r7r7r8r/ns :     -  ;   !$ )    3 6.5    )  r/cCs tjddtj}td|S)Nr,r)r;r4r5rpathsepfilter)rr7r7r8 _pythonpaths r=c sgttjg}tjtjkr|tj|D]w}|sqtjdvr0tj |ddn:tj dkr]tj |ddtj ddd tj |d d j tj d tj |d d gn |tj |d dgtjd krpqd|vruqtjd}|s~qtj |dddj tj d}|qtdtdf}fdd|DtjrtjtttWdn1swYtttS)z& Return a list of 'site' dirs )os2emxriscosLibr%rz local/librNrr&libz python{}.{}z site-pythondarwinzPython.frameworkHOMELibraryPythonrpurelibplatlibc3s|] }|vr|VqdSrr7rsitedirsr7r8rsz get_site_dirs..)extendr=rrrrrr;r<r%seprorrr4r5rrrrr8suppressAttributeErrorgetsitepackagesrrr)rrr#home_sp lib_pathsr7rHr8rsl            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<rA)r*rimportN) rr;r<rrrnr2r%rrr3rrstrip)inputsseenrGrZrrblinesliner7r7r8 expand_pathss@        rWc 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-inforNrrAz -nspkg.pth)PURELIBPLATLIB\rQz%s/%s/rcSsg|] \}}||fqSr7)r)rr^yr7r7r8rNrz$get_exe_prefixes..)r_ZipFileinfolistrrrrnrr%upperrcrrrRrSrrr3sortreverse) exe_filenamerrWrrrrpthr7r7r8r2/s4      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)rrrrrIr;r<rGbasedir_loadr#__init__rrrxr")rrrIr<r7r7r8rYszPthDistributions.__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)NFrtrQT#rr<)rr fromkeysrIr;r<rrr2rrRrrRrr%rr=popdirtyr3)r saw_importrTrbrVr<r7r7r8rbs6        $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 %srOrzDeleting empty %sF)rrrrrr rr _wrap_linesr%r;r<rrr2rHr=)r rel_pathsrUdatarbr7r7r8rs"     zPthDistributions.savecC|Srr7)rUr7r7r8rszPthDistributions._wrap_linescCsN|j|jvo|j|jvp|jtk}|r|j|jd|_t||dS)z"Add `dist` to the distribution mapTN) rjrrIr;getcwdrrr#rx)rrnew_pathr7r7r8rxs   zPthDistributions.addcCs<|j|jvr|j|jd|_|j|jvst||dS)z'Remove `dist` from the distribution mapTN)rjrryrr#rr7r7r8rys  zPthDistributions.removecCstjt|\}}t|j}|g}tjdkrdptj}t||krI||jkr6|tj | | |Stj|\}}||t||ks"|S)Nr) r;r<rrrraltseprKrcurdirr|r%)rr<npathlastbaselenrrKr7r7r8rs       zPthDistributions.make_relativeN)r7) r-r.r/r0rrrrr6rrxryrr7r7r7r8r0Ts    r0c@s(eZdZeddZedZedZdS)RewritePthDistributionsccs&|jV|D]}|Vq|jVdSr)preludepostlude)clsrUrVr7r7r8rs  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)r-r.r/ classmethodrrUrrr7r7r7r8rs   rSETUPTOOLS_SYS_PATH_TECHNIQUErawrewritecCs ttjtrtSttjS)z_ Return a regular expression based on first_line_re suitable for matching strings. )rrpatternrrecompilerr7r7r7r8_first_line_res rcCsX|tjtjfvrtjdkrt|tj||St\}}}|d|dd||ff)Nrrr<z %s %s) r;rryrrrS_IWRITErr>)funcargexcetevrr7r7r8 auto_chmods  rcCs0t|}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;rKr)rcacheresult prefix_lenpnpr7r7r8"_collect_zipimporter_cache_entriesAs   rcCs@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)r)rrupdaterr old_entry new_entryr7r7r8_update_zipimporter_cacheUs rcCst||dSr)r)rrr7r7r8rur:rcCdd}t|tj|ddS)NcSs |dSr)clearr<rr7r7r82clear_and_remove_cached_zip_archive_directory_datazs zf_remove_and_clear_zip_directory_cache_data..clear_and_remove_cached_zip_archive_directory_datarrr_zip_directory_cache)rrr7r7r8rys  r__pypy__cCr)NcSs&|t||tj||Sr)rrrupdaterrr7r7r8)replace_cached_zip_archive_directory_datas zT_replace_zip_directory_cache_data..replace_cached_zip_archive_directory_datarr)rrr7r7r8rs   rc Cs,z t||dWdSttfyYdSw)z%Is this string a valid Python script?execFT)r SyntaxError TypeError)rTrr7r7r8 is_pythons rc Cshz&tj|dd }|d}Wdn 1swYW|dkSW|dkSttfy3|YSw)zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)encodingrN#!)rhr2rcr.r/)rIfpmagicr7r7r8is_shs rcCs t|gS)z@Quote a command line argument according to Windows parsing rules subprocess list2cmdline)rr7r7r8 nt_quote_args rcCsH|ds |dr dSt||rdS|dr"d|dvSdS)zMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. r.pywTrrrF)rnrr splitlinesr)rrr7r7r8rs  r)rcGr(rr7)r}r7r7r8_chmodr)rc CsTtd||zt||WdStjy)}z td|WYd}~dSd}~ww)Nzchanging mode of %s to %ozchmod failed: %s)r rrr;error)r<rrir7r7r8rsrc@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. r7rr7r7r8rszCommandSpec.bestcCstjtj}tjd|S)N__PYVENV_LAUNCHER__)r;r<r?rrIr4r5)r_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)rparamr7r7r8 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)rstringrr7r7r8rszCommandSpec.from_stringcCs<t|||_t|}t|sdg|jdd<dSdS)Nz-xr)rr_extract_optionsoptionsrrrN)rrcmdliner7r7r8install_options s  zCommandSpec.install_optionscCs:|dd}t|}|r|dpdnd}|S)zH Extract any options from the first line of the script. rOrr<r)rrmatchgrouprR) orig_scriptfirstrrr7r7r8rs  zCommandSpec._extract_optionscCs||t|jSr)_renderrrrr7r7r8 as_headerszCommandSpec.as_headercCs6d}|D]}||r||r|ddSq|S)Nz"'r<r)rrn)item_QUOTESqr7r7r8 _strip_quotess zCommandSpec._strip_quotescCs tdd|D}d|dS)Ncss|] }t|VqdSr)rrrR)rrr7r7r8r's z&CommandSpec._render..rrOr)rrr7r7r8r%s  zCommandSpec._renderN)r-r.r/r0rr rrrrrrrrr6rrrrr7r7r7r8rs,        rc@seZdZeddZdS)WindowsCommandSpecF)rN)r-r.r/r rr7r7r7r8r0src@seZdZdZedZeZ e dddZ e dddZ e dd d Z ed d Ze d dZe ddZe ddZe dddZdS)rz` 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)rrrsrtWindowsScriptWriterrrget_script_headerr)rrrIwininstwriterheaderr7r7r8get_script_args_s  zScriptWriter.get_script_argscCs$tjdtdd|r d}|||S)NzUse get_headerr) stacklevelrD)rrrsrtr)rrrIrr7r7r8rgs  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. Nconsolegui_scripts) rrr} get_entry_mapr_ensure_safe_nametemplater_get_script_args) rrrrtype_rreprr}rr7r7r8rps   zScriptWriter.get_argscCstd|}|r tddS)z? Prevent paths in *_scripts entry point names. z[\\/]z+Path separators not allowed in script namesN)rsearchr)r has_path_sepr7r7r8rs zScriptWriter._ensure_safe_namecCs tdt|r tS|SNzUse best)rrrsrtrr)r force_windowsr7r7r8 get_writers zScriptWriter.get_writercCs*tjdkstjdkrtjdkrtS|S)zD Select the best ScriptWriter for this environment. win32javar)rrr;r_namerrrr7r7r8rszScriptWriter.bestccs|||fVdSrr7)rrrrrr7r7r8rszScriptWriter._get_script_argsrcCs"|j|}|||S)z;Create a #! line, getting options (if any) from script_text)command_spec_classrrrr)rrrIcmdr7r7r8rs zScriptWriter.get_header)NFr)rN)r-r.r/r0rPrQr7rrrrrrrr6rrrrrr7r7r7r8r4s,!#       rc@sLeZdZeZeddZeddZeddZeddZ e d d Z d S) rcCstdt|Sr)rrrsrtrrr7r7r8rs zWindowsScriptWriter.get_writercCs"tt|d}tjdd}||S)zC Select the best ScriptWriter suitable for Windows )rInaturalSETUPTOOLS_LAUNCHERrI)r WindowsExecutableLauncherWriterr;r4r5)r writer_lookuplauncherr7r7r8rs zWindowsScriptWriter.bestc #stddd|}|tjddvr$djd it}t|t gd}| || ||}fdd |D}|||d |fVd S) z For Windows, add a .py extension.pyarrPATHEXT;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.)r r -script.py.pyc.pyorrcg|]}|qSr7r7rrr7r8rrz8WindowsScriptWriter._get_script_args..rNr7) r r;r4rrrrrrrs UserWarningry_adjust_header) rrrrrextrrrr7rr8rs   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). rCrDr)rrepl)rrescape IGNORECASEsub _use_header)rr orig_headerrr 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)rRrrr)r clean_headerr7r7r8rs zWindowsScriptWriter._use_headerN) r-r.r/rrrrrrrr6rr7r7r7r8rs     rc@seZdZeddZdS)r c #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.pywrclir)rrrcrr7r7rrr7r8rrzDWindowsExecutableLauncherWriter._get_script_args..rrrcz .exe.manifestN)rget_win_launcherr9load_launcher_manifest) rrrrr launcher_typerrhdrrm_namer7rr8rs$  z0WindowsExecutableLauncherWriter._get_script_argsN)r-r.r/rrr7r7r7r8r sr cCsJd|}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)r9rrSr)type launcher_fnr7r7r8r# s   r#cCsttd}|dtS)Nzlauncher manifest.xmlr) pkg_resourcesrr-rvars)rmanifestr7r7r8r$ s r$FcCst|||Sr)rr)r< ignore_errorsonerrorr7r7r8r% r:rcCstd}t||S)N)r;umask)tmpr7r7r8r) s  rc@seZdZdZdS)rtzF Warning for EasyInstall deprecations, bypassing suppression. N)r-r.r/r0r7r7r7r8rt/ srtr)r)|r0rr rrrdistutils.errorsrrrr distutils.command.installr r rr r distutils.command.build_scriptsrrJrrr;rrr`r_rrr"rPrrrr5r8rrrhrdrrrrrrsetuptools.sandboxrsetuptools.commandrsetuptools.archive_utilrsetuptools.package_indexrrrrrsetuptools.wheelrr+rrrr r!r"r#r$r%r&r'r(r)r*r+filterwarnings PEP440Warning__all__r9r.rKrNrUr/r=rrWr1r2r0rr4r5rrrrrrrbuiltin_module_namesrrrrrrr ImportErrorrrrsys_executablerrrr rrr#r$rrrtr7r7r7r8s         D#L.)%l  R       TtA