Vc&Ccs ddlZddlZddlZddlZddlmZddlTddlm Z m Z ddl m Z GddeZ Gdd e e ZdS) N)Command)Z*) convert_path Mixin2to3)logcseZdZdZgdZddgZddiZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZddZdZdZdZdZdS)build_pyz5"build" pure Python modules (copy to build directory)))z build-lib=Zdzdirectory to "build" (copy) to)compileZczcompile .py to .pyc) no-compileNz!don't compile .py files [default])z optimize=ZOzlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])forcefz2forcibly build everything (ignore file timestamps)rrrcsvd|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) build_lib py_modulespackage package_data package_dirroptimizerself 3/usr/lib64/python3.11/distutils/command/build_py.pyinitialize_optionszbuild_py.initialize_options s@     cs|ddd|jj|_|jj|_|jj|_i|_|jjr;|jjD]\}}t||j|<||_ t|j ts@ t|j |_ dS#ttf$rtdwxYwdS)NZbuild)r r )rrzoptimize must be 0, 1, or 2)Zset_undefined_options distributionpackagesr r rZitemsrget_data_files data_files isinstancerZintZ ValueErrorZAssertionErrorZDistutilsOptionError)rZnamepath 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 cs|jr||jr(||||ddSNr)include_bytecode)r build_modulesrbuild_packagesbuild_package_data byte_compile get_outputsrrrrunz build_py.runCsy, ? !    = &    ! ! !  # # % % % $**A*>>?????rcs^ g}|js|S|jD]}||}tjj|jg|dz}d|rt|dzfd|||D}| ||||f|S)N.rcs$g|] }|d SN).0Zfileplen r z+build_py.get_data_files..ss. $TUU r) rget_package_dirosrjoinr splitZlenfind_data_filesappend)rZdatar src_dir build_dir filenamesr+ @rrzbuild_py.get_data_filesasM} K} B BG**733G '7'--:L:L'LNID &7||A~(,(<(.sF(((2U?(GNN2&&("(((r) r getglobr/rr0escaperextend)rr r4ZglobsZpatternZfilelistr:r7rr2zbuild_py.find_data_filesysD"&&r2..$(("556 ) )Gydk'.B.BLQXDYDY!Z!Z[[H LL((((x((( ) ) ) ) rcsD d}|jD]\}}}}|D]}tj||}|tj||tj|||ddS)NFZ preserve_mode)rr/rr0mkpathdirname copy_file)rZlastdirr r4r5r6filenameZtarget rr"zbuild_py.build_package_datas26:o 4 4 2GWi% 4 4i:: BGOOF33444rw||GX>>-24444 4 4 4rcs |d}|js|rtjj|SdSg}|r{ |jd|}|d|tjj|S#t $r"|d|d|d=YnwxYw|{|jd}||d||rtjj|SdS)Nr&r8r)r1rr/rr0ZinsertKeyErrorr;)rr rZtailZpdir rr.zbuild_py.get_package_dirs* H}}S!!  w|T**rD /+CHHTNN;D KK4(((7<..  !!!KK48,,,R! "'++B//)KK4(((7<..2s B)B/.B/cs|dkrbtj|std|ztj|std|z|rVtj|d}tj|r|Stjd|dS)Nr8z%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)) r/rZexistsZDistutilsFileErrorZisdirr0r9rwarn)rr rinit_py r check_packagezbuild_py.check_packages "  ?7>>+.. M(= KMMM7==-- ?(02=>???  ?gll; >>Gw~~g&& ?46=??? trcsttj|stjd||dSdS)Nz!file %s (for module %s) not foundFT)r/rr9rrH)rmodule module_filerr check_modulezbuild_py.check_modules7w~~k**  H8+v N N N54rcsJ|||tjtjtj|d}g}tj|jj}|D]}tj|}||kr[tj tj |d}| |||f| d|z|S)Nz*.pyrz excluding %s) rKr<r/rr0r=ZabspathrZ script_nameZsplitextZbasenamer3Z debug_print) rr rZ module_filesmodulesZ setup_scriptr Zabs_frLs rfind_package_moduleszbuild_py.find_package_moduless 7K000ydk+.F.F!O!OPP wt'8'DEE  @ @AGOOA&&E $ @))"'*:*:1*=*=>>qA34444  ,!>????rcs i}g}|jD]}|d}d|dd}|d} ||\}}n'#t$r||}d}YnwxYw|s7|||} |df||<| r||d| ftj||dz} | || s|||| f|S)Nr&rrEr'Z__init__.py) r r1r0rFr.rKr3r/rrN) rrrOrLrr Z module_baserZcheckedrIrMs 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:cs  g}|jr'|||jrJ|jD]B}||}|||}||C|Sr()r r>rRrr.rP)rrOr rZmrGrfind_all_moduleszbuild_py.find_all_moduless (  ? 0 NN4,,.. / / / = "= " ""227;; --g{CCq!!!!rcs>d|DS)Ncsg|] }|d S)rEr))r*rLs rr-z-build_py.get_source_files..-sAAAvr AAAr)rSrrrget_source_fileszbuild_py.get_source_files,s"AA)>)>)@)@AAAArcs\|gt|z|dzgz}tjj|S)NrQ)listr/rr0)rr5r rLZ outfile_pathrGrget_module_outfilezbuild_py.get_module_outfile/s/!{T']]2fun5EE w|\**rr'cs|}g}|D]\}}}|d}||j||}|||r|jr4|t j|d|j dkr9|t j||j |d|j Dz }|S)Nr&r8)Z optimizationrcsbg|],\}}}}|D]"}tj||#-Sr))r/rr0)r*r r4r5r6rC rr-z(build_py.get_outputs..BsW6)Y% GLLH - -r) rSr1rVr r3r importlibZutilZcache_from_sourcerr)rrrOZoutputsr rLrMrCrDrr$zbuild_py.get_outputs3s)'')).5 ? ? *WfkmmC((G..t~wOOH NN8 $ $ $ ?<4NN9>#C#C r$D$3$3444=1$?NN9>#C#C t}$D$>$>??? :>/  rcs~t|tr|d}n+t|ttfst d||j||}tj |}| || ||dS)Nr&z:'package' must be a string (dot-separated), list, or tuplerr?) rZstrr1rUZtupleZ TypeErrorrVr r/rrAr@rB)rrLrMr ZoutfileZdirrWr build_modulezbuild_py.build_moduleJs gs # # PmmC((GGGdE]33 PNPP P ))$.'6JJgoog&& C~~k7!~DDDrcsn|}|D]\}}}||||dSr()rRrY)rrOr rLrMrGrr zbuild_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)r')__name__ __module__ __qualname__Z descriptionZ user_optionsZboolean_optionsZ negative_optrrr%rr2r"r.rKrNrPrRrSrTrVr$rYr r!r#r)rrrrsxKK   L!'*O 9-LJJJ2@@@<0   444%%%N6   222h BBB+++. E E E<<<@@@(PPPPPrrcseZdZdZdZdS) build_py_2to3cs.g|_|jr||jr(||||j||ddSr) updated_filesr r rr!r"Zrun_2to3r#r$rrrr%zbuild_py_2to3.runs ? !    = &    ! ! !  # # % % % d())) $**A*>>?????rcst||||}|dr |j|d|S)Nr'r)rrYrbr3)rrLrMr ZresrGrrYzbuild_py_2to3.build_modulesG##D&+wGG q6 .   % %c!f - - - rN)r^r_r`r%rYr)rrraras5@@@ rra)r/Zimportlib.utilrXr\r<Zdistutils.corerZdistutils.errorsr]rrZ distutilsrrrar)rrrcs0  """"""22222222yPyPyPyPyPyPyPyPv Hir