o
    ¹i-  ã                	   @   s´  d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ zd dlZW n e	y1   d dl
ZY nw zd dlmZ W n e	yI   d dlmZ Y nw d dlmZ zd dlZW n e	yd   dZeeƒd‚w g d¢Ze d¡Z	d#d	ed
ee deddfdd„ZedkrØd dlZejddZejdddd ejddedd ejdddd e ¡ Zeej ƒd Z!e! "¡ rËdZe#ej$ %d¡ƒd krÅed!7 Ze&eƒ dS eej ej'ej(d"u ƒ dS dS )$é    N)ÚOptional)Úfiles)ÚPathz%Please install copier and jinja2-time)z".github/workflows/binder-on-pr.ymlz.github/workflows/build.ymlz#.github/workflows/check-release.ymlz..github/workflows/update-integration-tests.ymlzbinder/postBuildz.eslintignorez.eslintrc.jsz
.gitignorez.prettierignorez.prettierrcz.stylelintrcz
RELEASE.mdzbabel.config.jsúconftest.pyújest.config.jsúpyproject.tomlúsetup.pyztsconfig.jsonztsconfig.test.jsonzui-tests/README.mdz&ui-tests/jupyter_server_test_config.pyzui-tests/package.jsonzui-tests/playwright.config.jsz^jupyter_server([^\w]|$)TÚtargetÚvcs_refÚinteractiveÚreturnc           +      C   s´  t | ƒ ¡ } | d }| d }| d }| ¡ sd| ›}t|ƒ‚t|ƒ}t |¡}W d  ƒ n1 s3w   Y  d}	| ¡ rNt | 	¡ ¡}
|
 
di ¡ 
d¡}	|	du r}| ¡ rgtjtjddg| d	 d
¡ ¡ }	n|d }	d|	v r}|	dd…  dd¡ dd¡}	| d }| ¡ rŠt |¡ | 
dd¡}d}t|tƒr¤| 
dd¡}| 
d|¡}n|}d}| d  ¡ r±d}n| 
di ¡ 
dd¡r½d}| d  ¡ pÎ| d  ¡ pÎ| d  ¡ }||||d |	| 
dd ¡t| 
di ¡ 
d!d¡ƒt| d"  ¡ ƒt|ƒ| 
d#i ¡ 
d$d%¡d&œ
}d'}ttj d(¡ƒd)k rtj||||d*d+ ntj||||d*d*d, |d  ¡ }t |¡}W d  ƒ n	1 s6w   Y  | 
d-¡rT|d-  ¡ D ]\}}||d- |< qGn|d-  ¡ |d-< g }|retd.ƒnd/}|  ¡  !d0¡r™| "d1¡ | #d2i ¡ |d2  ¡ D ]\}}||d2 |< q€d3|d2 v r˜|d2 d3= n| "d4¡ |d d5 |d d5< t$dƒ %d6¡}| ¡ }t |¡}W d  ƒ n	1 sÄw   Y  | #d7i ¡ | #d-i ¡ |d8  ¡ D ]'\}}||d7 v rð| d9d:¡|d7 |< ||d- v r| d9d:¡|d- |< qÛd;D ]}|| rtt&||  ¡ ƒƒ||< q||= q| #d<d=¡ t| 
d>¡t'ƒr<d=|d> vr<|d>  "d=¡ d?|v rOd=|d? vrO|d?  "d=¡ | (tj)|d@dA¡ dB}| *dC¡D ]…}| +|¡}|j,dkroq`| -¡ rvq`| | }| ¡ s—|j.j/d*d*dD t ||¡ |j,dkr•d*}q`| 0¡ }| 0¡ }||kr¦q`| 1¡ t2v r¯d/ndE} |rÂtdF|›dG| › dHƒpÁ| ndE}|  ¡  !d0¡rÜt ||¡ |j,dkrÚd*}q`| "dI|›¡ q`|rÉ| dJ  ¡ r·zdKdl3}!W n t4y   dL}t5|ƒ Y n±w t6 7¡ }"| dJ  ¡ }#|" 8|#¡ W d  ƒ n	1 s"w   Y  | d }t | 	¡ ¡}
|"j
dMdNddO}$|$durKt't9dPdQ„ |$ :¡ ƒƒ}%ng }%|
d  
d7g ¡|% |
d d7< |" ;dR¡r¤|" dR¡D ]=\}&}'t't9dSdQ„ |' :¡ ƒƒ}(|&|
d  
dTi ¡v rš|
d  
dT¡du ri |
d dT< |
d dT |& |( }(|(|
d dT |&< qf| (|! )|
¡¡ | dJ  <¡  | "dU¡ | dV })|) ¡ rÉ|) <¡  | "dW¡ |D ]}*t5dX|*ƒ qËt5dYƒ dS )Za#  Update an extension to the current JupyterLab

    target: str
        Path to the extension directory containing the extension
    vcs_ref: str [default: None]
        Template vcs_ref to checkout
    interactive: bool [default: true]
        Whether to ask before overwriting content

    zpackage.jsonr   r   zNo package.json exists in NÚprojectÚnamez--name)ÚcwdÚutf8ú@é   ú/Ú_ú-Ú_temp_extensionÚauthorz<author_name>z<author_email>ÚemailÚfrontendzjupyter-configÚserverÚ
jupyterlabÚ	themePathÚ Úthemer   r   zui-testsÚdescriptionz<description>Ú	schemaDirÚbinderÚ
repositoryÚurlz<repository)
ÚkindÚauthor_nameÚauthor_emailÚlabextension_nameÚpython_nameÚproject_short_descriptionÚhas_settingsÚ
has_binderÚtestr"   z0https://github.com/jupyterlab/extension-templateÚ.©Ú8Ú0r0   T)r
   ÚdataÚdefaults)r
   r1   r2   ÚunsafeÚdevDependenciesz(Overwrite scripts in package.json? [n]: ÚyÚYzUpdated scripts in package.jsonÚscriptszinstall-extz-package.json scripts must be updated manuallyÚ	outputDirzstaging/package.jsonÚdependenciesÚresolutionsú~ú^)r7   r9   r4   ÚstyleModulezstyle/index.jsÚsideEffectsr   é   )ÚindentFÚ*)ÚparentsÚexist_okÚnzoverwrite "z"? [z]: zskipped _temp_extension/z	setup.cfgr   z5To update pyproject.toml, you need to install tomli-wÚoptionsÚinstall_requires)Úfallbackc                 S   s   | ot  | ¡d u S ©N)ÚJUPYTER_SERVER_REQUIREMENTÚmatch©Úr© rM   úW/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/jupyterlab/upgrade_extension.pyÚ<lambda>  s    z"update_extension.<locals>.<lambda>zoptions.extras_requirec                 S   s   | S rH   rM   rK   rM   rM   rN   rO     s    zoptional-dependencieszDELETED setup.cfgzMANIFEST.inzDELETED MANIFEST.inz**z2** Remove _temp_extensions directory when finished)=r   ÚresolveÚexistsÚRuntimeErrorÚopenÚjsonÚloadÚtomllibÚloadsÚ	read_textÚgetÚ
subprocessÚcheck_outputÚsysÚ
executableÚdecodeÚstripÚreplaceÚshutilÚrmtreeÚ
isinstanceÚdictÚboolÚtupleÚcopierÚ__version__ÚsplitÚrun_autoÚrun_copyÚitemsÚcopyÚinputÚupperÚ
startswithÚappendÚ
setdefaultr   ÚjoinpathÚsortedÚlistÚ
write_textÚdumpsÚrglobÚrelative_tor   Úis_dirÚparentÚmkdirÚ
read_bytesÚas_posixÚRECOMMENDED_TO_OVERRIDEÚtomli_wÚImportErrorÚprintÚconfigparserÚConfigParserÚ	read_fileÚfilterÚ
splitlinesÚhas_sectionÚunlink)+r	   r
   r   Úpackage_fileÚpyproject_fileÚ
setup_fileÚmsgÚfidr1   r(   Ú	pyprojectÚ
output_dirr   r&   r%   r$   Úhas_testÚextra_contextÚtemplateÚ	temp_dataÚkeyÚvalueÚwarningsÚchoiceÚroot_jlab_packageÚroot_jlab_dataÚoverride_pyprojectÚpÚrelpathÚfile_targetÚold_dataÚnew_dataÚdefaultr€   ÚconfigÚsetup_cfg_fileÚrequirements_rawÚrequirementsÚextraÚdeps_rawÚdepsÚmanifest_inÚwarningrM   rM   rN   Úupdate_extension;   s`  

ÿÿû


ÿ
ý
öÿÿÿ

€

ÿ€

 


€
ÿ€ý€þÿ
þÿ
ÿ


r«   Ú__main__zUpgrade a JupyterLab extension)r   z
--no-inputÚ
store_truez!whether to prompt for information)ÚactionÚhelpÚpathÚstorezthe target path)r®   Útyper¯   z	--vcs-refzthe template hash to checkout)r¯   r¡   z.copier-answers.ymlzrThis script won't do anything for copier template, instead execute in your extension directory:

    copier updater-   r.   z	 --UNSAFEF)NT))rƒ   rT   Úrera   rZ   r\   Útypingr   rV   r   ÚtomliÚimportlib.resourcesr   Úimportlib_resourcesÚpathlibr   rg   r   rR   r   ÚcompilerI   Ústrre   r«   Ú__name__ÚargparseÚArgumentParserÚparserÚadd_argumentÚ
parse_argsÚargsr°   Úanswer_filerQ   rf   rh   ri   r‚   r
   Úno_inputrM   rM   rM   rN   Ú<module>   sh   ÿÿ
þ
ÿÿÿÿ
þ rë