
    ~                     Z    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZddlm	Z	 d Z
y)	zBUtilities shared between local and cloud code dev implementations.    )absolute_import)division)print_function)unicode_literalsN)
exceptionsc                    |t         j                  j                  t         j                  j                  | |            }t         j                  j	                  |      r|S t        j                  dj                  |            dD ]G  }t        j                  t         j                  j                  | |            }|s9t        |      d   c S  y)a  Rules for choosing a service.yaml or app.yaml file.

  The rules are meant to discover common filename variants like
  'service.dev.yml' or 'staging-service.yaml'.

  Args:
    context: Build context dir. Could be '.'.
    arg: User's path (relative to context or absolute) to a yaml file with
      service config, or None. The service config could be a knative Service
      description or an appengine app.yaml.

  Returns:
    Absolute path to a yaml file, or None.
  NzFile '{}' not found.)z*service.dev.yamlz*service.dev.ymlz*service.yamlz*service.ymlr   )
ospathabspathjoinexistsr   Errorformatglobsorted)contextargcomplete_abs_pathpatternmatchess        -lib/googlecloudsdk/command_lib/code/common.pyChooseExistingServiceYamlr      s     	_Wc(BC	ww~~'(


1889JK
LLg iiWg67GG_Q 
    )__doc__
__future__r   r   r   r   r   r	   googlecloudsdk.corer   r    r   r   <module>r      s%    I &  % '  	 *r   