F2x.distutils.strategy.base module

class F2x.distutils.strategy.base.BuildStrategy(templates=None)

Bases: object

Basic build strategy.

A build strategy follows the build process and interacts with it at certain well-defined points.

  1. build_src - Generate and prepare sources for compilation.

  2. build_ext - Actually build binaries from (generated) sources.

Where each strategy intervenes and what it does is documented in the implementations.

finish_build_extension(build_ext, extension)

No customization here.

finish_distribution(build_src, distribution)

Update build_clib and build_py steps with newly collected libraries.

finish_wrap_sources(build_src, extension, target_dir)

Clean up after code generation. Put newly generated files where they belong.

Also creates a new library for the primary sources if requested by inline_sources.

get_ext_filename(build_src, extension)

No customization here (i.e., return None).

get_template_files(with_imports=False)

Collect all template files required for this strategy.

Parameters

with_imports – If set to True this will also try to extract imports for the the templates recursively.

load_templates(template_names)

Load a list with template names into a list with templates and extra information:

  • loaded template

  • template file name (as passed to loader)

  • full path to loaded template

  • package directory of containing package

prepare_build_extension(build_ext, extension)

Prepare build by updating include directories.

prepare_distribution(build_src, distribution)

Make sure distribution.libraries is at least an empty list.

prepare_extension(build_src, extension)

Prepare extension for code generation.

  • Collect information about extension sources into ext_modules.

  • Decide whether to split and split.

  • Collect libraries and modules form templates.

prepare_wrap_sources(build_src, extension, target_dir)

Prepare sources for wrapping. Make sure everything is where it is expected.

select_wrap_sources(build_src, extension, target_dir)

Collect information about sources to be built.

This method collects the following information about the module surces and passes them on:

  • name of original source file

  • target name of source file (from where code generation will take place)

  • names of new files to be expected

  • dependencies of those new files (i.e., templates, sources, interface config)

F2x.distutils.strategy.base.f90_module_name_match()

Matches zero or more characters at the beginning of the string.

F2x.distutils.strategy.base.fortran_ext_match()

Matches zero or more characters at the beginning of the string.