Stock actions

Stock actions are predefined common tasks (manipulating the filesystem, calling an external program, etc.) They all specialize Action.

class ActionTree.stock.NullAction

A stock action that does nothing. Useful as a placeholder for several dependencies.

class ActionTree.stock.CallSubprocess(args, **kwds)

A stock action that calls a subprocess.

Arguments are forwarded exactly to subprocess.check_call().

class ActionTree.stock.CreateDirectory(name)

A stock action that creates a directory. No error will be raised if the directory already exists. If the directory to create is nested, intermediate directories will be created as well.

Parameters:name (str) – the directory to create, passed to os.makedirs().
class ActionTree.stock.DeleteFile(name)

A stock action that deletes a file. No error will be raise if the file doesn’t exist.

Parameters:name (str) – the name of the file to delete, passed to os.unlink().
class ActionTree.stock.CopyFile(src, dst)

A stock action that copies a file. Arguments are passed to shutil.copy().

  • src (str) – the file to copy
  • dst (str) – the destination
class ActionTree.stock.TouchFile(name)

A stock action that touches a file. If the file already exists, its modification time will be modified. Else, it will be created, empty.

Note that the containing directory must exist. You might want to ensure that by adding a CreateDirectory as a dependency.

Parameters:name (str) – the name of the file to touch. Passed to open() and/or os.utime().
class ActionTree.stock.Sleep(secs)

A stock action that sleeps for a certain duration.

Parameters:secs (float) – seconds to sleep, passed to time.sleep().