yggdrasil.languages package

Subpackages

Submodules

yggdrasil.languages.install_languages module

yggdrasil.languages.install_languages.get_language_directories()[source]

Get language directories.

Returns:

Language directories.

Return type:

list

yggdrasil.languages.install_languages.import_language_install(language, no_import=False)[source]

Temporarily import a language installation script.

Parameters:
  • language (str) – Name of language that installation script should be imported for.

  • no_import (bool, optional) – If True, yggdrasil will not be imported. Defaults to False.

Yields:

module – Language installation module.

yggdrasil.languages.install_languages.install_all_languages(from_setup=False, arglist=None, **kwargs)[source]

Call install.py for all languages that have one and return a dictionary mapping from language name to the installation state (True if install was successful, False otherwise).

Parameters:
  • from_setup (bool, optional) – If True, the function is being called from setup.py and the positional arguments should not be parsed and unrecognized arguments will be ignored. Defaults to False.

  • arglist (list, optional) – List of arguments to parse. Defaults to None and sys.argv is used.

  • **kwargs – Additional keyword arguments are passed to each call to install_language.

Returns:

Mapping from language name to boolean describing installation

success.

Return type:

dict

yggdrasil.languages.install_languages.install_language(language, results=None, no_import=None, args=None, arglist=None)[source]

Call install for a specific language.

Parameters:
  • language (str) – Name of language that should be checked.

  • results (dict, optional) – Dictionary where result (whether or not the language is installed) should be logged. Defaults to None and is initialized to an empty dict.

  • no_import (bool, optional) – If True, yggdrasil will not be imported. Defaults to None and is set based on the value parsed from arglist.

  • args (argparse.Namespace, optional) – Arguments parsed from the command line. Default to None and is created.

  • arglist (list, optional) – List of arguments to parse. Defaults to None and sys.argv is used.

yggdrasil.languages.install_languages.is_dir(fdir)[source]

Determine if a directory is valid in a case-sensitive manner.

Parameters:

fdir (str) – Full directory path to be tested.

Returns:

True if the directory exists, False otherwise.

Return type:

bool

yggdrasil.languages.install_languages.is_file(fname)[source]

Determine if a file is valid in a case-sensitive manner.

Parameters:

fname (str) – Full file path to be tested.

Returns:

True if the file exists, False otherwise.

Return type:

bool

yggdrasil.languages.install_languages.is_path(fpath)[source]

Determine if a path is valid in a case-sensitive manner.

Parameters:

fpath (str) – Full path to be tested.

Returns:

True if the path exists, False otherwise.

Return type:

bool

yggdrasil.languages.install_languages.update_argparser(parser=None, language=None, no_import=None, from_setup=False, arglist=None)[source]

Update argument parser with language specific arguments.

Parameters:
  • parser (argparse.ArgumentParser, optional) – Existing argument parser that should be updated. Default to None and a new argument parser will be created.

  • language (str, optional) – Language that argument parser should be updated with options for. Defaults to None and all language options will be added.

  • no_import (bool, optional) – If True, yggdrasil will not be imported. Defaults to None and will be set based on sys.argv.

  • from_setup (bool, optional) – If True, the function is being called from setup.py and the positional arguments should not be parsed and unrecognized arguments will be ignored. Defaults to False.

  • arglist (list, optional) – List of arguments to parse. Defaults to None and sys.argv is used.

Returns:

Argument parser with language specific arguments.

Return type:

argparse.ArgumentParser

Module contents

yggdrasil.languages.get_language_dir(lang)[source]

Return the directory containing the interface for the requested language.

Parameters:

lang (str) – The name of the language to return a directory for.

Returns:

The full path to the interface directory for the language.

Return type:

str

yggdrasil.languages.get_language_ext(lang, default=None)[source]

Return the file extension associated with the requirested language.

Parameters:
  • lang (str) – Programming language that extension should be returned for.

  • default (str, optional) – Extension that should be returned if no extensions are registered for the language. Defaults to None and an error will be raised if there are not any extensions associated with the language.

Returns:

The most common extension associated with the specified language.

Return type:

str

Raises:

ValueError – If there are not any executables associated with a language.