o h @sJ ddlZddlZddlZddlmZddlmZdZGdddeZ dS)N)Command)DistutilsOptionErrorz.pyc@sxeZdZdZgdZgdZddiZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZdS) install_libz7install all Python modules (extensions and pure Python)))z install-dir=dzdirectory to install to)z build-dir=bz'build directory (where to install from))forcefz-force installation (overwrite existing files))compileczcompile .py to .pyc [default]) no-compileNzdon't compile .py files)z optimize=Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]) skip-buildNzskip the build steps)rr r r r cCs(d|_d|_d|_d|_d|_d|_dS)Nr) install_dir build_dirrr optimize skip_buildselfrD/opt/alt/python310/lib64/python3.10/distutils/command/install_lib.pyinitialize_options3s  zinstall_lib.initialize_optionsc Cs|ddddddd|jdurd|_|jdurd |_t|jts?zt|j|_|jd vr/tWdSttfy>td wdS) Ninstall) build_libr)rr)rr)r r )rr)rrTF)rzoptimize must be 0, 1, or 2)Zset_undefined_optionsr r isinstanceintAssertionError ValueErrorrrrrrfinalize_options<s,     zinstall_lib.finalize_optionscCs8||}|dur|jr||dSdSdSN)buildr distributionhas_pure_modules byte_compilerZoutfilesrrrrunVs zinstall_lib.runcCs:|js|jr |d|jr|ddSdSdSNbuild_py build_ext)rr"r#Z run_commandhas_ext_modulesrrrrr!fs   zinstall_lib.buildcCs6tj|jr||j|j}|S|d|jdS)Nz3'%s' does not exist -- no Python modules to install)ospathisdirrZ copy_treerwarnr%rrrrmszinstall_lib.installcCsvtjr |ddSddlm}|dj}|jr$||d|j||j d|j dkr9|||j |j||j |j ddSdS)Nz%byte-compiling is disabled, skipping.r)r$r)rrprefixdry_run)rrr/verboser0) sysdont_write_bytecoder.Zdistutils.utilr$get_finalized_commandrootr rr0rr1)rfilesr$Z install_rootrrrr$vs      zinstall_lib.byte_compilec Csd|sgS||}|}t||}t|ttj}g}|D]} |tj|| |dq|Sr ) r4 get_outputsgetattrlenr+sepappendr,join) rZhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesr prefix_lenZoutputsfilerrr_mutate_outputss  zinstall_lib._mutate_outputscCsrg}|D]2}tjtj|d}|tkrq|jr%|tjj |dd|j dkr6|tjj ||j dq|S)Nr) optimizationr) r+r,splitextnormcasePYTHON_SOURCE_EXTENSIONr r; importlibutilcache_from_sourcer)rZ py_filenamesZbytecode_filesZpy_fileZextrrr_bytecode_filenamess   zinstall_lib._bytecode_filenamescCsT ||jdd|j}|jr||}ng}||jdd|j}|||S)Nr(rr))r?r"r#rr rHr*)rZ pure_outputsZbytecode_outputsZ ext_outputsrrrr7s    zinstall_lib.get_outputscCsN g}|jr|d}|||jr%|d}|||Sr')r"r#r4extendr7r*)rZinputsr(r)rrr get_inputss    zinstall_lib.get_inputsN)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optrrr&r!rr$r?rHr7rJrrrrrs    r) r+importlib.utilrEr2Zdistutils.corerZdistutils.errorsrrDrrrrrs