Exemplo n.º 1
0
    def __init__(self, name, suffix):
        if suffix.startswith('.'):
            self.suffix = suffix
        else:
            self.suffix = '.' + suffix

        name_file = DataFile.clean('cache', name)
        self.cachedir = os.path.abspath(os.path.join(*name_file))
        MakeDirs.makedirs(self.cachedir)
        self.manifest_file = os.path.join(self.cachedir, MANIFEST_NAME)
        self.manifest = Merge.merge(*Yaml.read(self.manifest_file))
Exemplo n.º 2
0
  def __init__(self, name, suffix):
    if suffix.startswith('.'):
      self.suffix = suffix
    else:
      self.suffix = '.' + suffix

    name_file = CommandFile.clean('cache', name)
    self.cachedir = os.path.abspath(os.path.join(*name_file))
    MakeDirs.makedirs(self.cachedir)
    self.manifest_file = os.path.join(self.cachedir, MANIFEST_NAME)
    self.manifest = Merge.merge(*Yaml.read(self.manifest_file))
Exemplo n.º 3
0
def _make(path, value):
  path = os.path.expanduser(path)
  exists = os.path.exists(path)
  is_dict = isinstance(value, dict)
  if value is None or is_dict:
    if not exists:
      MakeDirs.makedirs(path)
      _print_path(path)
    if is_dict:
      for k, v in value.items():
        _make(os.path.join(path, k), v)
  elif exists:
    print('Not overwriting existing', path)
  else:
    with open(path, 'w') as f:
      f.write(value)
    _print_path(path)
Exemplo n.º 4
0
def _make(path, value):
    path = os.path.expanduser(path)
    exists = os.path.exists(path)
    is_dict = isinstance(value, dict)
    if value is None or is_dict:
        if not exists:
            MakeDirs.makedirs(path)
            _print_path(path)
        if is_dict:
            for k, v in value.items():
                _make(os.path.join(path, k), v)
    elif exists:
        print('Not overwriting existing', path)
    else:
        with open(path, 'w') as f:
            f.write(value)
        _print_path(path)