σ
λΎ[`c        	   @@ s  d  Z  d d l m Z m Z d d l Z d d l Z d d l m Z d d l Z d d l	 Z d d l
 m
 Z
 e
   Z e j   j Z d d  Z e d  Z e d	 d
  e _ e j j d e  g  e j _ e d g  d g   e j _ d d d d d g e j _ d d g e j _ d d d g e j _ d e j _ d e j _ d d g e j _ d e j _ e r|i d d 6e j _ n> i d d 6e j _ i d d e j j d f d 6e j j d <i d d 6e j _  i d d  6d d 6d d! 6e j _! e" e j _# e d" d#  e _$ d$ Z% e% e j$ _& i  e _' e d% i   e j' d& <d' e j _( d(   e j _) d)   Z* e* e j _+ d e j, e" d e" d*  Z- y e. t/  Wn e0 k
 r΅d a1 d a/ n Xd e j, e e g  e" d e" d+  Z2 d,   Z3 e j4 d-  Z5 e j4 d.  Z6 d e j, d/  Z7 d S(0   s3   
Module that enables user configuration and hooks.
i    (   t   absolute_importt   print_functionNi   (   t   utils(   t   VersionComparec         C@ s.   t  j |   r |  j   }  n  t  j |  |  S(   s  
    return a ConfigProperties instance defined with the given names.
    @param  names       the names of the properties to define, given as a
                          space-delimited string or as a list of strings.
    @param  parentName  the fully-qualified name of the parent property.
                          Provide this if this is defining a non-top-level
                          property.
    (   R   t	   is_stringt   splitt   ConfigProperty(   t   namest
   parentName(    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyt   defineProperties   s    	s   Eups distrib site usersΏ   userTags preferredTags globalTags reservedTags defaultTags verbose asAdmin setupTypes setupCmdName VRO fallbackFlavors defaultProduct startupFileName repoVersioner versionIncrementer colorizet   Eupst   verboset   pret   postt   versiont   versionExprt   currentt   stablet   latestt   commandLinet   keept   typet   exactt   buildt   setups2   type:exact commandLine version versionExpr currentt   defaults'   commandLine version versionExpr currents   %s %ss
   type:exactt   generict   implicitProductst   namet   tagt   lockDirectoryBaset   sitet
   __UPS_DB__t	   variablest   builders
   startup.pyc         C@ s   t  j d d |  S(   Ns   \+\d+$t    (   t   ret   sub(   t   pt   v(    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyt   <lambda>_   s    c         C@ s0   t  j d |  s | d St  j d d   |  S(   Ns   \+\d+$s   +1s   \+(\d+)$c         S@ s   d t  |  j d   d S(   Ns   +%di   (   t   intt   group(   t   m(    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyR(   h   s    (   R$   t   searchR%   (   t   productR   (    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyt   defaultVersionIncrementere   s    c   	      C@ s_  | s t  j j } n  g  } t j j |  |  } t j j |  s_ | r‘ | j d |  q‘ nB | r | d k r t d | d | n  t	 |  n  | j |  | r[t j j
 |   r[x t j |   D] } t j j
 t j j |  |   rφ qΙ n  t j d |  rqΙ n  | d	 k r qΙ n  t j j |  |  } | | k rGqΙ n  | j |  qΙ Wn  | S(
   Ns   [%s]i   t   sourcingt   files   (^\.|\.pyc$|~$|pickle)t   Makefilet   _caches_t   ups_db(   s   MakefileR2   s   ups_db(   t   configR
   t   startupFileNamet   ost   patht   joint   existst   appendt   printt   execute_filet   isdirt   listdirR$   R,   (	   t	   customDirR   t   logt   executet   filenamet   includeAllFilest   configFilest   startupt   f(    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyt   loadCustomizationFromDirl   s2    !c         C@ sQ  | s t  j j } n  | s' t | k r0 d a n  t d k	 rI | sI t Sn  g  a | a d t j k r{ t j	 t j d  n5 d t j k r° t j	 t j
 j t j d d   n  x* | D]" } t j	 t j
 j | d   q· Wd t j k rt j	 t j d  n( t j	 t j
 j t j
 j d  d   g  a xE t D]= }	 t |	 |  | d | d | d	 | }
 |
 r8t |
 7a q8q8Wd
 t j k rMxΒ t j d
 j d  D]§ } t j
 j |  sΡ| sFt d |  qFqy$ | rηt |  n  t j	 |  Wqt k
 rE} d | | f } t r2t j j |   qFt | d | qXqWn  t S(   sg  
    load all site and/or user customizations.  Customizations comes from a startup script file.

    This function looks for customizations first in a site directory.  By
    default this is $EUPS_DIR/site; however, it can be overridden with the
    $EUPS_SITEDATA.  Next it looks for customizations in a user directory
    with is $HOME/.eups by default but can be overridden with $EUPS_USERDATA.
    In each of these directories a startup script called, "startup.py"
    is searched for and loaded

    Finally, additional startup scripts can be run if $EUPS_STARTUP.  This
    environment variable contains a colon-delimited list of script file.  Each
    is executed in order.

    @param verbose    the verbosity level
    @param log        where to write log messages
    @param execute    process files?
    @param quiet      Be extra quiet
    @param reset      The list of files is usually cached; reset clears the cache
    @param filename   Name of file to search (default: config.Eups.startupFileName).
    @params includeAllFiles If execute is False, include all the files in the directory in the return list
    t   EUPS_SITEDATAt   EUPS_DIRR   t   EUPS_USERDATAt   ~s   .eupsRA   RB   RC   t   EUPS_STARTUPt   :s   Startup file %s doesn't exists   Processing %s: %sR0   N(   R4   R
   R5   t   customisationFilenamet   Nonet   customisationFilest   customisationDirsR6   t   environR:   R7   R8   t
   expanduserRG   R   R9   R;   R<   t	   Exceptiont   Falset   eupst
   exceptionst   CustomizationError(   R   R@   RA   t   quietR7   t   resetRB   RC   t   dt   dirt   cfilest   startupFilet   et   msg(    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyt   loadCustomization   sN    	& (	c         B@ s[  d d  l  } d d l  m } d d l m } i  } x: e   j   D]) } | j d  rB e   | | | <qB qB W~ i  } x9 d e j j f g D]" \ } } | | j   f | | <q We	 |   & }	 e
 |	 j   |  d  | e   UWd  QXxl | j   D]^ \ } }
 |
 \ } } xC | j   D]5 } | | k re d | | |  f d	 e j qqWqυ Wd  S(
   Ni    (   t   hooksi   (   R   t   __s   config.Eups.defaultProductt   execs+   Found unknown key %s in dictionary %s in %sR0   (   RV   Rb   R   t   globalst   keyst
   startswithR4   R
   t   defaultProductt   opent   compilet   readt   localst   itemsR;   R   t   stdwarn(   R^   RV   Rb   R   t   _globalst   keyt   checkDictKeyst   dnameR[   t   fdR'   t   keys0t   k(    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyR<   κ   s$    "%s   \s*#.*$s   \s*([:=]|\+=)\s*c         C@ s^  d } t  j j |   s d  St |   } d } zx| D]} | d 7} t j d |  j   } | sl q8 n  t j | d  } t	 |  d k rΞ | d k r8 | d k r8 t
 d | d | | d 8} q8 q8 n  | \ } }	 }
 |	 d k rς d	 }	 n  t j d
 d |
  }
 | j d  } t } xs t	 |  d k r| j d  } t | |  s| d k r{t
 d | |  | f d | n  Pn  t | |  } qWyq |	 d k rξt | | d  rξt | | d  d  k	 rξt | | d  d |
 }
 qξn  t | | d |
  Wq8 t k
 rF| d k rGt
 d | d |  | f d | qGq8 Xq8 WWd  | j   Xd  S(   Ni   i    i   R#   i   s   Bad property syntax (ignoring):R0   RM   t   =s   (^['\"]|['\"]\s*$)t   .s,   Skipping unrecognised category "%s" at %s:%ds   +=t    s'   Skipping unknown property "%s" at %s:%d(   R6   R7   R9   Ri   t   commreR%   t   stript	   namevalreR   t   lenR;   R$   R4   t   popt   hasattrt   getattrRO   t   setattrt   AttributeErrort   close(   t
   configFileR   R@   t   maxerrRs   t   linenot   linet   partsR   t   opt   valt   attrt   nxt(    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyt   loadConfigProperties  sR    
	,!*(8   t   __doc__t
   __future__R    R   R6   R$   R#   R   RV   t   eups.exceptionsR   t   version_cmpt   Flavort   setFallbackFlavorsRO   R	   R4   R
   t   setTypeR)   t   userTagst   dictt   defaultTagst   preferredTagst
   globalTagst   reservedTagsR   t   asAdmint
   setupTypest   setupCmdNamet   Truet   VROt   fallbackFlavorsRh   RU   t   colorizeR   t   _defaultLockDirectoryBaseR   t   distribR5   t   repoVersionerR.   t   versionIncrementert   stdinfoRG   R   RP   t	   NameErrorRN   Ra   R<   Rj   Ry   R{   R   (    (    (    sd   /data1/kirg/hscpipe8/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-4d7b902/eups/python/eups/hooks.pyt   <module>   sl   	(!		"
T	