
    8xd                     R   d dl Z d dlZd dlmZ d dlmZ d                                Z e j        d          Z	 e j        d          Z
 e j        d          Z e j        d          Z e j        d	 e j        ej                  z            Zd
 Zd Zd ZdefdZdefdZd ZdS )    N)
exceptions)
comma_joinz\
AGPL
LGPL
GPL3
GPL2
GPL
BSD
MIT
APACHE
PSF
CC
MOZILLA
PUBLIC-DOMAIN
PROPRIETARY
OTHER
NONE
z	GPL[^3]*2z	GPL[^2]*3zGPL[^2]*>= *2zCC\w+z[%s]c                 j    t                               |           pt                              |           S )z3True if family matches GPL3 or GPL >= 2, else False)gpl23_regexsearch
gpl3_regex)familys    :lib/python3.11/site-packages/conda_build/license_family.py
match_gpl3r   #   s)    f%%B):):6)B)BB    c                     |                                  } t          j        dd|           } t          j        dd|           } t          j        dd|           } |                                 S )z7Set to ALL CAPS, replace common GPL patterns, and stripzGENERAL PUBLIC LICENSEGPLzLESSER *LzAFFERO *A)upperresubstripss    r
   	normalizer   (   sW    			A
'22A
z3""A
z3""A7799r   c                 h    t                               d|           } t          j        dd|           } | S )z0Remove punctuation, spaces, tabs, and line feeds z\s+ )
punk_regexr   r   r   s    r
   remove_special_charactersr   1   s-    sAA
vr1AHr   c                     t          | t                    r*|                     d|                     d                    }n| }t          ||          S )Return best guess of license_family from the conda package index.

    Note: Logic here is simple, and focuses on existing set of allowed families
    license_familylicense)
isinstancedictgetguess_license_family)index
recognizedlicense_names      r
   guess_license_family_from_indexr(   8   sM     % yy!1599Y3G3GHHj999r   c                 p   | dS t          |           } t          j        dd|           }t          |          rdS t                              |          rdS t                              |           rdS t          |           } |D ]}t          |          | v r|c S |D ]}| t          |          v r|c S dS )	r   NNONEz[A,L]GPLr   GPL3GPL2CCOTHER)r   r   r   r   
gpl2_regexr   cc_regexr   )r'   r&   	sans_lgplr	   s       r
   r$   r$   F   s     v\**L z2|44I) v			9	%	% v		&	& t,\::L  $V,,<<MMM =  4V<<<<MMM =7r   c                 4   	 | d         d         }n# t           $ r Y d S w xY wd t          D             }t          t          |                    |vrGt	          t          j        d|dt          t          t                              d                    d S )Naboutr   c                 F    g | ]}t          t          |                    S  )r   r   ).0fams     r
   
<listcomp>z/ensure_valid_license_family.<locals>.<listcomp>j   s4       69!)C..11  r   zabout/license_family 'z$' not allowed. Allowed families are .)	KeyErrorallowed_license_familiesr   r   RuntimeErrorr   indentr   sorted)metar   allowed_familiess      r
   ensure_valid_license_familyrA   e   s    g'78    =U   !>!:!:;;CSSS!>>:f5M.N.N#O#O#O#OQ 
 
 	
 TSs    
)r   stringconda_buildr   conda_build.utilsr   splitr;   compiler/   r   r   r0   escapepunctuationr   r   r   r   r(   r$   rA   r5   r   r
   <module>rI      s>   
			  " " " " " " ( ( ( ( ( (  
EGG! & RZ$$
RZ$$
bj))2:hRZ6+=!>!>>??
C C C
     +/;S : : : : '+7O    >
 
 
 
 
r   