PyFoam.Applications.CreateModuleFile module

Application-class that implements pyFoamCreateModuleFile.py

Generate a Modules modulefile for OpenFOAM using differences in environment variables before and after sourcing the main OpenFOAM configuration file

For more information on Modules, visit the Environment Modules Project: http://modules.sourceforge.net

Usage : pyFoamCreateModuleFile.py OpenFOAM_CfgFile moduleFile

For example: pyFoamCreateModuleFile.py ./bashrc /tmp/module
Warning #1: This command will not work if your OpenFOAM environment variabales are already
initialized.

Warning #2: This command will not work if you are using the superuser account (aka: root)

Author:
Martin Beaudoin, Hydro-Quebec, 2012. All rights reserved
class PyFoam.Applications.CreateModuleFile.CreateModuleFile(args=None, **kwargs)[source]

Bases: PyFoam.Applications.PyFoamApplication.PyFoamApplication

__init__(args=None, **kwargs)[source]
Parameters:
  • description – description of the command
  • epilog – text to be printed after the options-help
  • examples – usage examples to be printed after the epilog
  • usage – Usage
  • interspersed – Is the command line allowed to be interspersed (options after the arguments)
  • args – Command line arguments when using the Application as a ‘class’ from a script
  • nr – Number of required arguments
  • changeVersion – May this application change the version of OF used?
  • exactNr – Must not have more than the required number of arguments
  • subcommands – parse and use subcommands from the command line. Either True or a list with subcommands
  • inputApp – Application with input data. Used to allow a ‘pipe-like’ behaviour if the class is used from a Script
  • localConfigurationFile – Use this file (or list of files) as a local configuration
  • findLocalConfigurationFile – Method to find a configuration file BEFORE the actual parameters are parsed
  • allowCurses – This application can wrap the output in a curses-window
__module__ = 'PyFoam.Applications.CreateModuleFile'
addOptions()[source]

Add options to the parser

removeComponentFromPathEnvVar(pathEnvVar, removePathComponents)[source]

Remove components from PATH env var. Order preserving

removeComponentWithSubstrFromPathEnvVar(pathEnvVar, removeSubStr)[source]

Remove components from PATH env var where a substring is present. Order preserving

run()[source]

Run the real application

uniqifyPathEnvVar(pathEnvVar)[source]

Remove all duplicates from PATH env var. Order preserving

writeModuleAliasEntry(fid, aliasesVarDict, homeVar, userVar)[source]

Write Modules file aliases

writeModuleEnvironmentEntry(fid, envVarDict, homeVar, userVar)[source]

Write Modules file environment variables

writeModuleFileFooter(fid)[source]

Write Modules file footer

writeModuleFileHeader(fid, version)[source]

Write Modules file header