
    5im	                         d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
mZ d Zed	k(  r		  e        yy# e
$ r"Z ej                   ee             Y dZ[ydZ[ww xY w)
a  
Utility for locating the module (or package's __init__.py)
associated with a given console_script name
and verifying it contains the PYTHON_ARGCOMPLETE_OK marker.

Such scripts are automatically generated and cannot contain
the marker themselves, so we defer to the containing module or package.

For more information on setuptools console_scripts, see
https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation

Intended to be invoked by argcomplete's global completion function.
    N)
EntryPoint)entry_points)Iterable   )ArgcompleteMarkerNotFoundfindc                     t         j                  d   } t        j                  j	                  |       }t               }t         j                  dk  r|d   }|D cg c]$  }|j                  |k(  s|j                  dk(  s#|& }}|st        d      |d   }|j                  j                  dd      \  }}t        |       5 }|j                         }d d d        dj                  ||      vrt        d      d	j                  |      |vrt        d      t        t        |d
            5 }|j                  d      }	d d d        d	vrt        d      y c c}w # 1 sw Y   xY w# 1 sw Y   *xY w)Nr   )      console_scriptsz$no entry point found matching scriptr   :zfrom {} import {}z&does not appear to be a console scriptzsys.exit({}())T)return_packagei   PYTHON_ARGCOMPLETE_OKzmarker not found)sysargvospathbasenameimportlib_entry_pointsversion_infonamegroupr   valuesplitopenreadformatr   )
script_pathr   r   epentry_pointmodule_namefunction_namefscriptheads
             /home/marpiech/ifpan-abm-pgxpred/analysis/marpiech-gwas-test/venv/lib/python3.12/site-packages/argcomplete/_check_console_script.pymainr'      sf   ((1+K 77K(D)?)AL '!#$56!-c2DRXXQbEbBcLc'(NOOq/K!,!2!2!8!8a!@K 
k	 a!!+}=VK'(PQQ}-V;'(PQQ 
d;t4	5 vvd|d*'(:;; +% d  s*   E.E>E E,E'E$'E0__main__)__doc__r   r   importlib.metadatar   r   r   typingr   _check_moduler   r   r'   __name__eexitstr     r&   <module>r3      sd    
 
 ) E  :"<J z  % Qs   7 AAA