MakeLauncher Class

The MakeLauncher class acts as a wrapper around subprocess to launch the make executable.
To give an example of extracting the make database in the current directory.

from py_makefile_dbparse.launcher import MakeLauncher

mklaunch = MakeLauncher(workdir='./')
dbtxt = mklaunch.run('-pn')

Class Description

class MakeLauncher

A wrapper class for launching make.

Public Functions

__init__(cmd = 'make', opts = '', makefile = 'Makefile', workdir = '')

Class initialiser.

Parameters
  • cmd: path to the make executable (default = make).

  • opts: Additional options to pass to make (default = ‘’).

  • makefile: Name of the Makefile to use (default = Makefile).

  • workdir: Working directory to use when running make (default = ‘’ current directory).

run(localopts, stdin_txt = None)

Launches make.

Return

The stdout from make.

Parameters
  • localopts: additional command line options to pass to make.

  • stdin_txt: text to pass to the standard input of the make process.

read_makefile()

Reads the content of a Makefile referenced by the class.

Return

The text of the Makefile.

write_makefile(contents)

Writes the given content to the Makefile referenced by the class.

Parameters
  • contents: the contents to write to the makefile.

Public Members

cmd

Path to the make executable.

opts

Additional command line options to pass to make.

makefile

Can be used to specify an alternative Makefile file name.

workdir

Can be used to specify an alternative working directory.

stdout

The returned standard output from make.

stderr

The returned error output from make.