B ñ~Ö¼c""ã@s”ddlZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddlm Z ddlZe d¡ZGd d „d eƒZGd d „d ee ƒZdS) éN)ÚST_MODE)Ú sysconfig)ÚCommand)Únewer)Ú convert_pathÚ Mixin2to3)Úlogs^#!.*python[0-9.]*([ ].*)?$c@sHeZdZdZdddgZdgZdd„Zdd „Zd d „Zd d „Z dd„Z dS)Ú build_scriptsz("build" scripts (copy and fixup #! line))z build-dir=Údzdirectory to "build" (copy) to)ÚforceÚfz1forcibly build everything (ignore file timestamps)z executable=Úez*specify final destination interpreter pathr cCs"d|_d|_d|_d|_d|_dS)N)Ú build_dirÚscriptsr Ú executableÚoutfiles)Úself©rúB/opt/alt/python37/lib/python3.7/distutils/command/build_scripts.pyÚinitialize_optionss z build_scripts.initialize_optionscCs| dddd¡|jj|_dS)NZbuild)r r)r r )rr)Zset_undefined_optionsZ distributionr)rrrrÚfinalize_options%s zbuild_scripts.finalize_optionscCs|jS)N)r)rrrrÚget_source_files,szbuild_scripts.get_source_filescCs|js dS| ¡dS)N)rÚ copy_scripts)rrrrÚrun/szbuild_scripts.runc Cs¾| |j¡g}g}x(|jD]}d}t|ƒ}tj |jtj |¡¡}| |¡|j spt ||ƒspt   d|¡qyt |dƒ}Wn tk rž|js–‚d}YnXXt |j¡\}}| d¡| ¡} | sÖ| d|¡qt | ¡} | röd}|  d¡pôd} |rt  d ||j¡| |¡|jstjs.|j} n(tj t d ¡d t d ¡t d ¡f¡} t | ¡} d| | d} y|  d¡Wn$tk r¢t d !| ¡ƒ‚YnXy|  |¡Wn&tk rØt d !| |¡ƒ‚YnXt |dƒ}| "| ¡| #| $¡¡WdQRX|r<| %¡q|r&| %¡| |¡| &||¡qWtj'dkr¶xh|D]`}|jrlt  d|¡nDt (|¡t)d@}|dBd@}||krRt  d|||¡t *||¡qRW||fS)NFznot copying %s (up-to-date)Úrbrz%s is an empty file (skipping)Téózcopying and adjusting %s -> %sZBINDIRz python%s%sZVERSIONZEXEs#!ó zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})ÚwbÚposixzchanging mode of %siÿimz!changing mode of %s from %o to %o)+ZmkpathrrrÚosÚpathÚjoinÚbasenameÚappendr rrÚdebugÚopenÚOSErrorÚdry_runÚtokenizeÚdetect_encodingÚreadlineÚseekÚwarnÚ first_line_reÚmatchÚgroupÚinforZ python_buildrZget_config_varÚfsencodeÚdecodeÚUnicodeDecodeErrorÚ ValueErrorÚformatÚwriteÚ writelinesÚ readlinesÚcloseZ copy_fileÚnameÚstatrÚchmod)rrÚ updated_filesZscriptZadjustZoutfiler ÚencodingÚlinesZ first_liner/Z post_interprZshebangZoutfÚfileZoldmodeZnewmoderrrr5s                  zbuild_scripts.copy_scriptsN) Ú__name__Ú __module__Ú __qualname__Ú descriptionZ user_optionsZboolean_optionsrrrrrrrrrr sr c@seZdZdd„ZdS)Úbuild_scripts_2to3cCs&t |¡\}}|js| |¡||fS)N)r rr(Zrun_2to3)rrr>rrrrœs zbuild_scripts_2to3.copy_scriptsN)rBrCrDrrrrrrFšsrF)r Úrer<rZ distutilsrZdistutils.corerZdistutils.dep_utilrZdistutils.utilrrrr)Úcompiler.r rFrrrrÚs