Beispiel #1
0
def set_project_path(project_path=None, show_error=True, prompt=True):
    original_path = os.path.abspath(
        os.path.expanduser(project_path or os.curdir))
    path = original_path

    global _PROJECT_PATH, _DATA_PATH, _ASSET_PATH
    while not _possible_project(path):
        p = os.path.dirname(path)
        if p != path:
            path = p
            continue
        if prompt:
            if MakeEmptyProject.ask_to_make_empty_project(original_path):
                path = original_path
                break
            else:
                _PROJECT_PATH = None
                return False
        if show_error:
            print(
                "\nYour path %s isn't in an echomesh project." % original_path)
            print("Defaulting to the echomesh path %s." % ECHOMESH_PATH)
        path = ECHOMESH_PATH
        break

    _PROJECT_PATH = path
    _DATA_PATH = os.path.join(path, 'data')
    _ASSET_PATH = os.path.join(path, 'asset')
    os.chdir(path)
    return True
Beispiel #2
0
def set_project_path(project_path=None, show_error=True, prompt=True):
    assert not prompt
    original_path = os.path.abspath(
        os.path.expanduser(project_path or os.curdir))
    path = original_path

    global _PROJECT_PATH, _DATA_PATH, _ASSET_PATH
    while not _possible_project(path):
        p = os.path.dirname(path)
        if p != path:
            path = p
            continue
        if prompt:
            if MakeEmptyProject.ask_to_make_empty_project(original_path):
                path = original_path
                break
            else:
                _PROJECT_PATH = None
                return False
        if show_error:
            print("\nYour path %s isn't in an echomesh project." %
                  original_path)
            print("Defaulting to the echomesh path %s." % ECHOMESH_PATH)
        path = ECHOMESH_PATH
        break

    _PROJECT_PATH = path
    _DATA_PATH = os.path.join(path, 'data')
    _ASSET_PATH = os.path.join(path, 'asset')
    os.chdir(path)
    return True
Beispiel #3
0
def set_project_path(project_path=None, show_error=False, prompt=True):
  original_path = os.path.abspath(os.path.expanduser(project_path or os.curdir))
  path = original_path

  while not _possible_project(path):
    p = os.path.dirname(path)
    if p != path:
      path = p
      continue
    if prompt:
      if MakeEmptyProject.ask_to_make_empty_project(original_path):
        path = original_path
        break
    if show_error:
      print("\nYour path %s isn't in an echomesh project." % original_path)
      print("Defaulting to the echomesh path %s." % ECHOMESH_PATH)
    path = ECHOMESH_PATH
    break

  global PROJECT_PATH, COMMAND_PATH, ASSET_PATH
  PROJECT_PATH = path
  COMMAND_PATH = os.path.join(path, 'command')
  ASSET_PATH = os.path.join(path, 'asset')
  os.chdir(path)
Beispiel #4
0
from __future__ import absolute_import, division, print_function, unicode_literals

from echomesh.base import MakeEmptyProject

MakeEmptyProject.make_empty_project('/tmp')