ó
¼S]c           @@  s‡   d  Z  d d l m Z d d l Z d d l m Z d d l m Z d d l j	 j
 Z
 d Z e d Z d
 „  Z d e f d „  ƒ  YZ d S(   s&   Project file loading and manipulation.i    (   t   absolute_importN(   t   YamlFile(   t   EnvSpecs   anaconda-project.ymls   anaconda-project.yamls
   kapsel.ymls   kapsel.yamlc           C@  s   t  d d d g  d d ƒ f S(   Nt   namet   defaultt   channelst   conda_packages(    (   R   (    (    (    s<   lib/python2.7/site-packages/anaconda_project/project_file.pyt   _empty_default_env_spec   s    t   ProjectFilec           B@  s;   e  Z d  Z d Z e e d „ ƒ Z e d „ Z d „  Z RS(   sÿ  Represents the ``anaconda-project.yml`` file which describes the project across machines/users.

    State that's specific to a machine/user/checkout/deployment
    should instead be in ``LocalStateFile``.  ``ProjectFile``
    would normally be checked in to source control or otherwise
    act as a shared resource.

    Be careful with creating your own instance of this class,
    because you have to think about when other code might load or
    save in a way that conflicts with your loads and saves.

    s  
# This is an Anaconda project file.
#
# Here you can describe your project and how to run it.
# Use `anaconda-project run` to run the project.
# The file is in YAML format, please see http://www.yaml.org/start.html for more.
#

#
# Set the 'name' key to name your project
#
name:

#
# Set the 'icon' key to give your project an icon
#
icon:

#
# Set a one-sentence-or-so 'description' key with project details
#
description:

#
# In the commands section, list your runnable scripts, notebooks, and other code.
# Use `anaconda-project add-command` to add commands.
#
commands: {}

#
# In the variables section, list any environment variables your code depends on.
# Use `anaconda-project add-variable` to add variables.
#
variables: {}

#
# In the services section, list any services that should be
# available before your code runs.
# Use `anaconda-project add-service` to add services.
#
services: {}

#
# In the downloads section, list any URLs to download to local files
# before your code runs.
# Use `anaconda-project add-download` to add downloads.
#
downloads: {}

#
# In the packages section, list any packages that must be installed
# before your code runs.
# Use `anaconda-project add-packages` to add packages.
#
packages: []

#
# In the channels section, list any Conda channel URLs to be searched
# for packages.
#
# For example,
#
# channels:
#    - mychannel
#
channels: []

#
# In the platforms section, list platforms the project should work on
# Examples: "linux-64", "osx-64", "win-64"
# Use `anaconda-project add-platforms` to add platforms.
#
platforms: []

#
# You can define multiple, named environment specs.
# Each inherits any global packages or channels,
# but can have its own unique ones also.
# Use `anaconda-project add-env-spec` to add environment specs.
#
env_specs: {}
c         C@  s^   x? t  D]7 } t j j | | ƒ } t j j | ƒ r t | ƒ Sq Wt t j j | t ƒ | ƒ S(   s+  Load the project file from the given directory, even if it doesn't exist.

        If the directory has no project file, the loaded
        ``ProjectFile`` will be empty. It won't actually be
        created on disk unless you call ``save()``.

        If the file has syntax problems, this sets the
        ``corrupted`` and ``corrupted_error_message`` properties,
        and attempts to modify the file will raise an
        exception. If the project file has semantic problems, they
        are not detected by this class but are reported by the
        ``Project`` class.

        Args:
            directory (str): path to the project directory
            default_env_specs_func (function makes list of EnvSpec): if file is created, use these

        Returns:
            a new ``ProjectFile``

        (   t   possible_project_file_namest   ost   patht   joint   isfileR   t   DEFAULT_PROJECT_FILENAME(   t   clst	   directoryt   default_env_specs_funcR   R   (    (    s<   lib/python2.7/site-packages/anaconda_project/project_file.pyt   load_for_directory|   s
    c         C@  s#   | |  _  t t |  ƒ j | ƒ d S(   s7  Construct a ``ProjectFile`` with the given filename and requirement registry.

        It's easier to use ``ProjectFile.load_for_directory()`` in most cases.

        If the file has syntax problems, this sets the
        ``corrupted`` and ``corrupted_error_message`` properties,
        and attempts to modify the file will raise an
        exception. If the project file has semantic problems, they
        are not detected by this class but are reported by the
        ``Project`` class.

        Args:
            filename (str): path to the project file
        N(   t   _default_env_specs_funct   superR   t   __init__(   t   selft   filenameR   (    (    s<   lib/python2.7/site-packages/anaconda_project/project_file.pyR   ™   s    	c         C@  sI  t  j j t  j j |  j ƒ ƒ | d <| d j t j ƒ  ƒ |  j d  k	 sQ t
 ‚ |  j ƒ  } | d  k	 so t
 ‚ x% | D] } | j ƒ  | d | j <qv Wt | ƒ d k rEt t | d ƒ ƒ } | d | } d „  } d | k rú | | d | d ƒ n  d | k r| | d | d ƒ n  d | k rE| | d | d ƒ qEn  d  S(   NR   t	   platformst	   env_specsi   c         S@  s   | 2| j  |  ƒ |  2d  S(   N(   t   extend(   t   srct   dest(    (    s<   lib/python2.7/site-packages/anaconda_project/project_file.pyt   move_list_elements»   s    t   packagesR   (   R
   R   t   basenamet   dirnameR   R   t	   conda_apit   default_platforms_with_currentR   t   Nonet   AssertionErrort   to_jsonR   t   lent   nextt   iter(   R   t   as_jsont   default_env_specst   env_spect	   spec_namet	   spec_jsonR   (    (    s<   lib/python2.7/site-packages/anaconda_project/project_file.pyt   _fill_default_content«   s"    %	(	   t   __name__t
   __module__t   __doc__t   templatet   classmethodR   R   R   R.   (    (    (    s<   lib/python2.7/site-packages/anaconda_project/project_file.pyR      s   S(   s   anaconda-project.ymls   anaconda-project.yamls
   kapsel.ymls   kapsel.yaml(   R1   t
   __future__R    R
   t   anaconda_project.yaml_fileR   t   anaconda_project.env_specR   t#   anaconda_project.internal.conda_apit   internalR!   R	   R   R   R   (    (    (    s<   lib/python2.7/site-packages/anaconda_project/project_file.pyt   <module>   s   
	