local task(name) = {
  name: 'packages | Install ' + name,
  tags: name,
  block: [
    {
      name: 'packages | Install ' + name + ' with pip',
      pip: {
        name: name,
        virtualenv: '{{ python_venv_root }}/' + name,
        state: 'latest',
      },
    },
    {
      name: 'packages | Symlink ' + name + ' executable',
      file: {
        src: '{{ python_venv_root }}/' + name + '/bin/' + name,
        dest: '{{ xdg_dir.bin_home }}/' + name,
        state: 'link',
      },
    },
  ],
};

local packages = ['translatepy', 'kapitan', 'cambd'];

std.manifestYamlDoc(
  [
    {
      name: 'packages | Create directory to store virtualenv environments',
      file: {
        path: '{{ python_venv_root }}',
        state: 'directory',
        mode: '755',
      },
    },
  ] + [task(x) for x in packages],
  quote_keys=false
)
