Vc&C ddlZddlZddlZddlZddlmZddlTddlm Z m Z ddl m Z GddeZ Gdd e e ZdS) N)Command)*) convert_path Mixin2to3)logceZdZdZgdZddgZddiZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZddZdZdZdZdZdS)build_pyz5"build" pure Python modules (copy to build directory)))z build-lib=dzdirectory to "build" (copy) to)compileczcompile .py to .pyc) no-compileNz!don't compile .py files [default])z optimize=Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])forcefz2forcibly build everything (ignore file timestamps)r rr cvd|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) build_lib py_modulespackage package_data package_dirr optimizerselfs 3/usr/lib64/python3.11/distutils/command/build_py.pyinitialize_optionszbuild_py.initialize_options s@     c|ddd|jj|_|jj|_|jj|_i|_|jjr;|jjD]\}}t||j|<||_ t|j ts@ t|j |_ dS#ttf$rtdwxYwdS)Nbuild)rr)rrzoptimize must be 0, 1, or 2)set_undefined_options distributionpackagesrrritemsrget_data_files data_files isinstancerint ValueErrorAssertionErrorDistutilsOptionError)rnamepaths rfinalize_optionszbuild_py.finalize_options*s# ""7#=#5 7 7 7 )2 +6 -:   ( <"/;AACC < < d)5d);); &&--//$--- J J #DM 2 2 / J J J*+HIII J  J Js C((!D c|jr||jr(||||ddSNr)include_bytecode)r build_modulesr!build_packagesbuild_package_data byte_compile get_outputsrs rrunz build_py.runCsy, ? !    = &    ! ! !  # # % % % $**A*>>?????rc^ g}|js|S|jD]}||}tjj|jg|dz}d|rt|dzfd|||D}| ||||f|S)N.rc$g|] }|d SN).0fileplens r z+build_py.get_data_files..ss. $TUU r) r!get_package_dirosr+joinrsplitlenfind_data_filesappend)rdatarsrc_dir build_dir filenamesr>s @rr#zbuild_py.get_data_filesasM} K} B BG**733G '7'--:L:L'LNID &7||A~(,(<(.sF(((2U?(GNN2&&("(((r) rgetglobrAr+rBescaperextend)rrrHglobspatternfilelistrPs @rrEzbuild_py.find_data_filesysD"&&r2..$(("556 ) )Gydk'.B.BLQXDYDY!Z!Z[[H LL((((x((( ) ) ) ) rcD d}|jD]\}}}}|D]}tj||}|tj||tj|||ddS)NF preserve_mode)r$rAr+rBmkpathdirname copy_file)rlastdirrrHrIrJfilenametargets rr2zbuild_py.build_package_datas26:o 4 4 2GWi% 4 4i:: BGOOF33444rw||GX>>-24444 4 4 4rc |d}|js|rtjj|SdSg}|r{ |jd|}|d|tjj|S#t $r"|d|d|d=YnwxYw|{|jd}||d||rtjj|SdS)Nr7rLr)rCrrAr+rBinsertKeyErrorrQ)rrr+tailpdirs rr@zbuild_py.get_package_dirs* H}}S!!  w|T**rD /+CHHTNN;D KK4(((7<..  !!!KK48,,,R! "'++B//)KK4(((7<..2s B)B/.B/c|dkrbtj|std|ztj|std|z|rVtj|d}tj|r|Stjd|dS)NrLz%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz __init__.pyz8package init file '%s' not found (or not a regular file)) rAr+existsDistutilsFileErrorisdirrBrNrwarn)rrrinit_pys r check_packagezbuild_py.check_packages "  ?7>>+.. M(= KMMM7==-- ?(02=>???  ?gll; >>Gw~~g&& ?46=??? trcttj|stjd||dSdS)Nz!file %s (for module %s) not foundFT)rAr+rNrrk)rmodule module_files r check_modulezbuild_py.check_modules7w~~k**  H8+v N N N54rcJ|||tjtjtj|d}g}tj|jj}|D]}tj|}||kr[tj tj |d}| |||f| d|z|S)Nz*.pyrz excluding %s) rmrRrAr+rBrSabspathr script_namesplitextbasenamerF debug_print) rrr module_filesmodules setup_scriptrabs_fros rfind_package_moduleszbuild_py.find_package_moduless 7K000ydk+.F.F!O!OPP wt'8'DEE  @ @AGOOA&&E $ @))"'*:*:1*=*=>>qA34444  ,!>????rc i}g}|jD]}|d}d|dd}|d} ||\}}n'#t$r||}d}YnwxYw|s7|||} |df||<| r||d| ftj||dz} | || s|||| f|S)Nr7rrbr8__init__.py) rrCrBrdr@rmrFrAr+rq) rr!ryror+r module_basercheckedrlrps r find_moduleszbuild_py.find_modulessS  o @ @F<<$$DhhtAbDz**Gr(K )1'):&gg   "227;;   C,,WkBB%0!$4!CNNGZ#ABBB ',,{K%4GHHK$$V[99  NNG[+> ? ? ? ?s A!A:9A:c  g}|jr'|||jrJ|jD]B}||}|||}||C|Sr:)rrTrr!r@r|)rryrrms rfind_all_moduleszbuild_py.find_all_moduless (  ? 0 NN4,,.. / / / = "= " ""227;; --g{CCq!!!!rc>d|DS)Ncg|] }|d S)rbr;)r<ros rr?z-build_py.get_source_files..-sAAAvr AAAr)rrs rget_source_fileszbuild_py.get_source_files,s"AA)>)>)@)@AAAArc\|gt|z|dzgz}tjj|S)Nr)listrAr+rB)rrIrro outfile_paths rget_module_outfilezbuild_py.get_module_outfile/s/!{T']]2fun5EE w|\**rr8c|}g}|D]\}}}|d}||j||}|||r|jr4|t j|d|j dkr9|t j||j |d|j Dz }|S)Nr7rL) optimizationrcbg|],\}}}}|D]"}tj||#-Sr;)rAr+rB)r<rrHrIrJr_s rr?z(build_py.get_outputs..BsW6)Y% GLLH - -r) rrCrrrFr importlibutilcache_from_sourcerr$)rr/ryoutputsrrorpr_s rr4zbuild_py.get_outputs3s)'')).5 ? ? *WfkmmC((G..t~wOOH NN8 $ $ $ ?<4NN9>#C#C r$D$3$3444=1$?NN9>#C#C t}$D$>$>??? :>/  rc~t|tr|d}n+t|ttfst d||j||}tj |}| || ||dS)Nr7z:'package' must be a string (dot-separated), list, or tuplerrY) r%strrCrtuple TypeErrorrrrAr+r\r[r])rrorproutfiledirs r build_modulezbuild_py.build_moduleJs gs # # PmmC((GGGdE]33 PNPP P ))$.'6JJgoog&& C~~k7!~DDDrcn|}|D]\}}}||||dSr:)rr)rryrrorps rr0zbuild_py.build_modulesYsP##%%.5 < < *Wfk   fk7 ; ; ; ;  < > > F////// ":  %bf_F < P L#z&$, P P P P =1  P L#z&$, P P P P P P P PrN)r8)__name__ __module__ __qualname__ description user_optionsboolean_options negative_optrr,r5r#rEr2r@rmrqr|rrrrr4rr0r1r3r;rrr r sxKK   L!'*O 9-LJJJ2@@@<0   444%%%N6   222h BBB+++. E E E<<<@@@(PPPPPrr ceZdZdZdZdS) build_py_2to3c.g|_|jr||jr(||||j||ddSr.) updated_filesrr0r!r1r2run_2to3r3r4rs rr5zbuild_py_2to3.runs ? !    = &    ! ! !  # # % % % d())) $**A*>>?????rct||||}|dr |j|d|S)Nr8r)r rrrF)rrorprress rrzbuild_py_2to3.build_modulesG##D&+wGG q6 .   % %c!f - - - rN)rrrr5rr;rrrrs5@@@ rr)rAimportlib.utilrrrRdistutils.corerdistutils.errorsrrr distutilsrr rr;rrrs0  """"""22222222yPyPyPyPyPyPyPyPv Hir