buildtest.utils.shell

Module Contents

Classes

Shell(shell='bash')

class buildtest.utils.shell.Shell(shell='bash')
__repr__(self)

Return repr(self).

__str__(self)

Return str(self).

get(self)

Return shell attributes as a dictionary

property opts(self)

retrieve the shell opts that are set on init, and updated with setter

property path(self)

This method returns the full path to shell program using shutil.which() If shell program is not found we raise an exception. The shebang is is updated assuming path is valid which is just adding character ‘#!’ in front of path. The return is full path to shell program. This method automatically updates the shell path when there is a change in attribute self.name

>>> shell = Shell("bash")
>>> shell.path
'/usr/bin/bash'
>>> shell.name="sh"
>>> shell.path
'/usr/bin/sh'