Example #1
0
    def __init__(self,
                 args=None,
                 usage=None,
                 version=None,
                 description=None,
                 interspersed=False):
        """
        @param usage: usage string. If missing a default is used
        @param version: if missing the PyFoam-version is used
        @param description: description of the utility
        @param interspersed: needs to be false if options should be passed to an OpenFOAM-utility
        @param args: Command line arguments. If unset sys.argv[1:] is used.
        Can be a string: it will be splitted then unsing the spaces (very primitive), or a list of strings (prefered)
        """
        if usage == None:
            if oldApp():
                usage = "%prog [options] <foamApplication> <caseDir> <caseName> [foamOptions]"
            else:
                usage = "%prog [options] <foamApplication> [foamOptions]"

        if version == None:
            version = "%prog " + versionString()

        if args == None:
            self.argLine = None
        elif type(args) == str:
            self.argLine = args.split()
        else:
            self.argLine = map(str, args)

        OptionParser.__init__(
            self,
            usage=usage,
            # prog=self.__type__.__name__,
            version=version,
            description=description,
            formatter=TitledHelpFormatter())

        if interspersed:
            self.enable_interspersed_args()
        else:
            self.disable_interspersed_args()

        self.options = None
        self.args = None

        self.__foamVersionChanged = False
        self.__oldEnvironment = None
Example #2
0
    def __init__(self,
                 args=None,
                 usage=None,
                 version=None,
                 description=None,
                 interspersed=False):
        """
        @param usage: usage string. If missing a default is used
        @param version: if missing the PyFoam-version is used
        @param description: description of the utility
        @param interspersed: needs to be false if options should be passed to an OpenFOAM-utility
        @param args: Command line arguments. If unset sys.argv[1:] is used.
        Can be a string: it will be splitted then unsing the spaces (very primitive), or a list of strings (prefered)
        """
        if usage==None:
            if oldApp():
                usage="%prog [options] <foamApplication> <caseDir> <caseName> [foamOptions]"
            else:
                usage="%prog [options] <foamApplication> [foamOptions]"
                
        if version==None:
            version="%prog "+versionString()

        if args==None:
            self.argLine=None
        elif type(args)==str:
            self.argLine=args.split()
        else:
            self.argLine=map(str,args)
            
        OptionParser.__init__(self,
                              usage=usage,
                              # prog=self.__type__.__name__,
                              version=version,
                              description=description,
                              formatter=TitledHelpFormatter())

        if interspersed:
            self.enable_interspersed_args()
        else:
            self.disable_interspersed_args()
        
        self.options=None
        self.args=None
        
        self.__foamVersionChanged=False
        self.__oldEnvironment=None
Example #3
0
    def __init__(self,
                 args=None,
                 usage=None,
                 version=None,
                 description=None,
                 epilog=None,
                 examples=None,
                 interspersed=False):
        """
        @param usage: usage string. If missing a default is used
        @param version: if missing the PyFoam-version is used
        @param description: description of the utility
        @param epilog: Text to be displayed in the help after the options
        @param examples: Usage examples to be displayed after the epilog
        @param interspersed: needs to be false if options should be passed to an OpenFOAM-utility
        @param args: Command line arguments. If unset sys.argv[1:] is used.
        Can be a string: it will be splitted then unsing the spaces (very primitive), or a list of strings (prefered)
        """
        if usage == None:
            if oldApp():
                usage = "%prog [options] <foamApplication> <caseDir> <caseName> [foamOptions]"
            else:
                usage = "%prog [options] <foamApplication> [foamOptions]"

        if version == None:
            version = "%prog " + versionString()

        if args == None:
            self.argLine = None
        elif type(args) == str:
            self.argLine = args.split()
        else:
            self.argLine = map(str, args)

        if examples:
            if epilog is None:
                epilog = ""
            else:
                epilog += "\n\n"
            usageText = "Usage examples:"
            #            epilog+=usageText+"\n\n"+("="*len(usageText))+"\n\n"+examples
            epilog += usageText + "\n\n" + examples

        OptionParser.__init__(
            self,
            usage=usage,
            # prog=self.__type__.__name__,
            version=version,
            description=description,
            epilog=epilog,
            formatter=FoamHelpFormatter())

        if self.epilog:
            self.epilog = self.expand_prog_name(self.epilog)

        if interspersed:
            self.enable_interspersed_args()
        else:
            self.disable_interspersed_args()

        self.options = None
        self.args = None

        self.__foamVersionChanged = False
        self.__oldEnvironment = None
Example #4
0
 def pyFoamVersion(self):
     """@return: Version number of the PyFoam"""
     return versionString()
Example #5
0
 def pyFoamVersion(self):
     """:return: Version number of the PyFoam"""
     return versionString()
Example #6
0
from setuptools import setup

import glob, os, sys

scriptlist = glob.glob(os.path.join('bin', '*.py'))
scriptlist += glob.glob(os.path.join('sbin', '*.py'))

from PyFoam import versionString
from PyFoam.ThirdParty.six import print_

setup(
    name='PyFoam',
    version=versionString(),
    packages=[
        'PyFoam', 'PyFoam.Applications', 'PyFoam.Basics', 'PyFoam.Execution',
        'PyFoam.Infrastructure', 'PyFoam.IPythonHelpers', 'PyFoam.LogAnalysis',
        'PyFoam.RunDictionary', 'PyFoam.Paraview', 'PyFoam.Site',
        'PyFoam.ThirdParty', 'PyFoam.ThirdParty.ply',
        'PyFoam.ThirdParty.Gnuplot', 'PyFoam.Wrappers'
    ],
    description='Python Utilities for OpenFOAM',
    url='http://www.ice-sf.at',
    author='Bernhard Gschaider',
    author_email='*****@*****.**',
    scripts=scriptlist,
)

try:
    import numpy
except ImportError:
    print_("\n\n")
Example #7
0
File: setup.py Project: floli/tools
from distutils.core import setup

import glob,os

scriptlist =glob.glob(os.path.join('bin', '*.py')) 
scriptlist+=glob.glob(os.path.join('sbin', '*.py')) 

from PyFoam import versionString

setup(name='PyFoam',
      version=versionString(),
      packages=['PyFoam',
                'PyFoam.Applications',
                'PyFoam.Basics',
                'PyFoam.Execution',
                'PyFoam.LogAnalysis',
                'PyFoam.RunDictionary',
                'PyFoam.Infrastructure',
                'PyFoam.Paraview',
                'PyFoam.ThirdParty',
                'PyFoam.ThirdParty.ply',
                'PyFoam.ThirdParty.Gnuplot'],
      description='Python Utilities for OpenFOAM',
      url='http://www.ice-sf.at',
      author='Bernhard Gschaider',
      author_email='*****@*****.**',
      scripts=scriptlist,
      )

try:
    import numpy
    def __init__(self,
                 args=None,
                 usage=None,
                 version=None,
                 description=None,
                 epilog=None,
                 examples=None,
                 interspersed=False):
        """
        :param usage: usage string. If missing a default is used
        :param version: if missing the PyFoam-version is used
        :param description: description of the utility
        :param epilog: Text to be displayed in the help after the options
        :param examples: Usage examples to be displayed after the epilog
        :param interspersed: needs to be false if options should be passed to an OpenFOAM-utility
        :param args: Command line arguments. If unset sys.argv[1:] is used.
        Can be a string: it will be splitted then unsing the spaces (very primitive), or a list of strings (prefered)
        """
        if usage==None:
            if oldApp():
                usage="%prog [options] <foamApplication> <caseDir> <caseName> [foamOptions]"
            else:
                usage="%prog [options] <foamApplication> [foamOptions]"

        if version==None:
            version="%prog "+versionString()

        if args==None:
            self.argLine=None
        elif type(args)==str:
            self.argLine=args.split()
        else:
            self.argLine=[str(a) for a in args]

        if examples:
            if epilog is None:
                epilog=""
            else:
                epilog+="\n\n"
            usageText="Usage examples:"
#            epilog+=usageText+"\n\n"+("="*len(usageText))+"\n\n"+examples
            epilog+=usageText+"\n\n"+examples

        OptionParser.__init__(self,
                              usage=usage,
                              # prog=self.__type__.__name__,
                              version=version,
                              description=description,
                              epilog=epilog,
                              formatter=FoamHelpFormatter())

        if self.epilog:
             self.epilog=self.expand_prog_name(self.epilog)

        if interspersed:
            self.enable_interspersed_args()
        else:
            self.disable_interspersed_args()

        self.options=None
        self.args=None

        self.__foamVersionChanged=False
        self.__oldEnvironment=None