a
    \Df                     @  s   d Z ddlmZ ddlZeeZddlZddlm	Z	 ddl
mZmZ ddlmZ d	Zddd
ddddddZedkrddlZeejdkrejd ndZeejdkrejd ndZeeed
ZeD ]Zee qeeedk dS )zs This module is intended for use in  CI workflows to help with validating
built sdist, wheel, and conda packages.

    )annotationsN)Path   )__version__	resources   )is_full_release)validate)version	build_dirz
str | Nonez	list[str])r
   r   returnc           
   
   C  s  g }| du r t dkr@|d n | t kr@|d|  dt  d tt rt dkrzt  W n4 ty } z|d|  W Y d}~n
d}~0 0 tjdd	}tjdd
d}|j|j }|D ]}t|}|	 s|d|  q|
 jdkr|d|  q|durt|d |j }	z"t|	|s>|d|  W q tyd   |d|	  Y q0 qttjd d	 s|d |S )a   Perform some basic package validation checks for the installed package.

    Args:
        version (str | None, optional) :
            A version to compare against the package's reported version

        build_dir (str | None, optional) :
            A path to a JS build dir to make detailed BokehJS file comparisons

    Returns:
        list[str]
            A list of all errors encountered

    Nz0.0.0zInvalid version 0.0.0z!Version mismatch: given version (z) != package version ()z4SRI hashes for BokehJS files could not be verified: absolute)modeT)r   Zminifiedzmissing BokehJS file: r   zEmpty BokehJS file: Zjsz2BokehJS package file differs from build dir file: zmissing build dir file: r   zpy.typedzpy.typed is missing)r   appendr   r   Zverify_sri_hashesRuntimeErrorZ	ResourcesZjs_filesr   existsstatst_sizenamefilecmpcmpFileNotFoundError__file__parentsjoinpath)
r
   r   errorserZrminZpackage_js_pathspathpackage_pathZ
build_path r!   _/nfs/NAS7/SABIOD/METHODE/ermites/ermites_venv/lib/python3.9/site-packages/bokeh/util/package.pyr	   *   s<    &
r	   __main__   )__doc__
__future__r   logging	getLogger__name__logr   pathlibr    r   r   r
   r   __all__r	   syslenargvr   r   errorprintexitr!   r!   r!   r"   <module>   s"   
D
