The cleanmymac.schema Module

For a list of examples please see the builtin targets found in cleanmymac.builtins

cleanmymac.schema.IsDirUserExpand(msg=None, clsoverride=None)[source]

Verify the directory exists.

>>> IsDirUserExpand()('/')
'/'
cleanmymac.schema.validate_yaml_config(config)[source]

performs the validation of the YAML definition of the global cleanmymac configuration. The current supported syntax allows for the specification of extra environment variables on a per target basis. See for example the case when the anaconda target is not in PATH:

cleanmymac: {
  targets_path: ['.']
}
anaconda: {
  env: {
    PATH: '~/anaconda/bin',
  },
}
Parameters:config (dict) – the loaded configuration
Returns:the validate configuration
Return type:dict
cleanmymac.schema.validate_yaml_target(description, strict=True)[source]

performs the validation of the YAML definition of a cleanmymac.target.Target. Currently two kinds of schemas are supported.

  • Shell command based Targets
type: 'cmd'
spec: {
  update_commands: [
    'conda update conda',
    'conda update anaconda'
  ],
  clean_commands: [
    'conda clean -p -s -t -y'
  ]
}
  • Directory based Targets
type: 'dir'
spec: {
    update_message: 'Get the latest Java version from http://www.oracle.com/technetwork/java/javase/downloads/index.html',
    entries: [
        {
            dir: '/Library/Java/JavaVirtualMachines',
            pattern: 'jdk1\.6\.\d_\d+\.jdk'
        },
        {
            dir: '/Library/Java/JavaVirtualMachines',
            pattern: 'jdk1\.7\.\d_\d+\.jdk'
        },
        {
            dir: '/Library/Java/JavaVirtualMachines',
            pattern: 'jdk1\.8\.\d_\d+\.jdk'
        },
    ]
}
Parameters:
  • description (dict) – the loaded description
  • strict (bool) – perform strict validation (fail on invalid specification if True)
Returns:

the validate description

Return type:

dict