c.b.p.intltool : module documentation

Part of canonical.buildd.pottery

Functions to build PO templates on the build slave.
Function find_potfiles_in Search the current directory and its subdirectories for POTFILES.in.
Function check_potfiles_in Check if the files listed in the POTFILES.in file exist.
Function find_intltool_dirs Search the current directory and its subdiretories for intltool
Function get_translation_domain Get the translation domain for this PO directory.
Function chdir Undocumented
Function generate_pot Generate one PO template using intltool.
Function generate_pots Top-level function to generate all PO templates in a package.
Class ConfigFile Represent a config file and return variables defined in it.
Class Substitution Find and replace substitutions.
Function _get_AC_PACKAGE_NAME Get the value of AC_PACKAGE_NAME from function parameters.
Function _try_substitution Try to find a substitution in the config files.
def find_potfiles_in():
Search the current directory and its subdirectories for POTFILES.in.
ReturnsA list of names of directories that contain a file POTFILES.in.
def check_potfiles_in(path):
Check if the files listed in the POTFILES.in file exist.
def find_intltool_dirs():
Search the current directory and its subdiretories for intltool structure.
def _get_AC_PACKAGE_NAME(config_file):
Get the value of AC_PACKAGE_NAME from function parameters.

The value of AC_PACKAGE_NAME is either the first or the fourth parameter of the AC_INIT call if it is called with at least two parameters.

def _try_substitution(config_files, varname, substitution):
Try to find a substitution in the config files.
ReturnsThe completed substitution or None if none was found.
def get_translation_domain(dirname):
Get the translation domain for this PO directory.

Imitates some of the behavior of intltool-update to find out which translation domain the build environment provides. The domain is usually defined in the GETTEXT_PACKAGE variable in one of the build files. Another variant is DOMAIN in the Makevars file. This function goes through the ordered list of these possible locations, top to bottom, and tries to find a valid value. Since the same variable name may be defined in multiple files (usually configure.ac and Makefile.in.in), it needs to keep trying with the next file, until it finds the most specific definition.

If the found value contains a substitution, either autoconf style (@...@) or make style ($(...)), the search is continued in the same file and back up the list of files, now searching for the substitution. Multiple substitutions or multi-level substitutions are not supported.

@contextmanager
def chdir(directory):
Undocumented
def generate_pot(podir, domain):
Generate one PO template using intltool.
ParameterspodirThe PO directory in which to build template.
domainThe translation domain to use as the name of the template. If it is None or empty, 'messages.pot' will be used.
ReturnsTrue if generation succeeded.
def generate_pots(package_dir='.'):
Top-level function to generate all PO templates in a package.
API Documentation for Launchpad, generated by pydoctor at 2010-09-27 00:00:11.