Package yagdoc :: Module makefile :: Class Makefile
[show private | hide private]
[frames | no frames]

Type Makefile

object --+
         |
        Makefile


Makefile parser and variable extractor.
Method Summary
  __init__(self)
str, list of str expand(self, text)
Expand Makefile variables in a string.
str get(self, name, expand)
Get a single Makefile variable.
  scan(self, source)
Read variable assignments from a Makefile.
  _expand_match(self, match)
Expand a single Makefile variable match.
  _expand_text(self, text)
Expand a string with Makefile variable references.
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__
Inherited from SRE_Pattern: _assignment, _varhead, _variable_sub

Method Details

expand(self, text)

Expand Makefile variables in a string.

Undefined variables are expanded to empty text, as make would expand them.

The second return value, list of unexpanded names, can contain for instance GNU make functions. The items are only the names, the second item returned for:
   HEADERS = $(wildcard *.h)
will be just ['wildcard'].
Parameters:
text - Text to expand Makefile variables in.
           (type=str)
Returns:
Expanded text and list of unexpanded names.
           (type=str, list of str)

get(self, name, expand=True)

Get a single Makefile variable.

Undefined variables are expanded to empty text, as make would expand them.

If you want to check potential problems, use:
   makefile.expand('$(%s)' % name)
instead of this method as it also returns the list of variable-like constructs remaining in the text.
Parameters:
name - Variable name.
           (type=str)
expand - True (the default) to expand the contents of the variable, False to obtain it unexpanded.
           (type=bool)
Returns:
Contents of variable name.
           (type=str)

scan(self, source=None)

Read variable assignments from a Makefile.
Parameters:
source - Makefile to read. If unspecified, read Makefile from the current directory.
           (type=iterable of str)

_expand_match(self, match)

Expand a single Makefile variable match.

_expand_text(self, text)

Expand a string with Makefile variable references.

Generated by Epydoc 2.1 on Fri Oct 5 00:36:53 2007 http://epydoc.sf.net