a
    còf�  ã                   @   s‚   d Z dZddlmZ ddlZddlZG dd„ deƒZejZdZ	dZ
d	Zd
ZeZe	Ze
ZeZeZG dd„ deƒZdd„ Zdd„ ZdS )zProtobuf Runtime versions and validators.

It should only be accessed by Protobuf gencodes and tests. DO NOT USE it
elsewhere.
zshaod@google.com (Dennis Shao)é    )ÚEnumNc                   @   s   e Zd ZdZdZdS )ÚDomainé   é   N)Ú__name__Ú
__module__Ú__qualname__ZGOOGLE_INTERNALÚPUBLIC© r
   r
   ú\/home/httpd/docs/test/DocsMgr/lib/python3.9/site-packages/google/protobuf/runtime_version.pyr      s   r   é   é   r   Ú c                   @   s   e Zd ZdZdS )ÚVersionErrorz&Exception class for version violation.N)r   r   r   Ú__doc__r
   r
   r
   r   r   *   s   r   c                 C   s   t | ƒ‚d S )N)r   )Úmsgr
   r
   r   Ú_ReportVersionError.   s    r   c           
   	   C   s„  t  d¡}|dur"| ¡ dkr"dS t› dt› dt› t› �}|› d|› d|› |› �}|dk sj|dk sj|dk rxtd|› �ƒ‚d}	| tkr¤t	d|› d	| j
› d
tj
› d�ƒ |tkrî|td krÎt d|||f ¡ n t	d|› d	|› d
|› d|	› �ƒ t|k �st|k�r.t|k �r.t	d|› d	|› d
|› d|	› �ƒ n(t|k�sBt|k�rVt d|||f ¡ |tk�r€t	d|› d	|› d
|› d|	› �ƒ dS )aü  Function to validate versions.

  Args:
    gen_domain: The domain where the code was generated from.
    gen_major: The major version number of the gencode.
    gen_minor: The minor version number of the gencode.
    gen_patch: The patch version number of the gencode.
    gen_suffix: The version suffix e.g. '-dev', '-rc1' of the gencode.
    location: The proto location that causes the version violation.

  Raises:
    VersionError: if gencode version is invalid or incompatible with the
    runtime.
  Z)TEMORARILY_DISABLE_PROTOBUF_VERSION_CHECKNÚtrueÚ.r   zInvalid gencode version: z`See Protobuf version guarantees at https://protobuf.dev/support/cross-version-runtime-guarantee.zBDetected mismatched Protobuf Gencode/Runtime domains when loading z
: gencode z	 runtime z2. Cross-domain usage of Protobuf is not supported.r   zºProtobuf gencode version %s is exactly one major version older than the runtime version %s at %s. Please update the gencode to avoid compatibility violations in the next runtime release.zIDetected mismatched Protobuf Gencode/Runtime major versions when loading z". Same major version is required. zEDetected incompatible Protobuf Gencode/Runtime versions when loading zC. Runtime version cannot be older than the linked gencode version. z†Protobuf gencode version %s is older than the runtime version %s at %s. Please avoid checked-in Protobuf gencode that can be obsolete.zKDetected mismatched Protobuf Gencode/Runtime version suffixes when loading z%. Version suffixes must be the same. )ÚosÚgetenvÚlowerÚMAJORÚMINORÚPATCHÚSUFFIXr   ÚDOMAINr   ÚnameÚwarningsÚwarn)
Z
gen_domainZ	gen_majorZ	gen_minorZ	gen_patchZ
gen_suffixÚlocationZdisable_flagÚversionZgen_versionÚerror_promptr
   r
   r   ÚValidateProtobufRuntimeVersion2   s†    
ÿÿÿÿÿýÿÿÿÿþÿÿÿÿþÿþÿ
ÿÿÿþÿr#   )r   Ú
__author__Úenumr   r   r   r   r	   Z
OSS_DOMAINZ	OSS_MAJORZ	OSS_MINORZ	OSS_PATCHZ
OSS_SUFFIXr   r   r   r   r   Ú	Exceptionr   r   r#   r
   r
   r
   r   Ú<module>   s$   