Gaudi Framework, version v23r4

Home   Generated: Mon Sep 17 2012
Classes | Functions | Variables

cmt2cmake Namespace Reference

Classes

class  Package
class  Project

Functions

def makeParser
def extName
def isPackage
def isProject
def projectCase
def callStringWithIndent
def main

Variables

tuple CMTParser = makeParser()
tuple ignored_packages = set(["GaudiSys", "GaudiRelease", "GaudiPolicy"])
tuple data_packages = set(['Det/SQLDDDB', 'FieldMap', 'TCK/HltTCK'])
tuple ignore_dep_on_subdirs = set(ignored_packages)
tuple needing_python = ('LoKiCore', 'XMLSummaryKernel', 'CondDBUI')
tuple no_pedantic
tuple _shelve_file
tuple known_subdirs = shelve.open(_shelve_file)
list all_packs
tuple idx = all_packs.index('Event/GenEvent')
tuple pr = Project("/home/marco/Devel/LHCb/workspace/LHCb_trunk")
list pack = pr.packages[all_packs[idx]]

Function Documentation

def cmt2cmake::callStringWithIndent (   cmd,
  arglines 
)
Produce a string for a call of a command with indented arguments.

>>> print callStringWithIndent('example_command', ['arg1', 'arg2', 'arg3'])
example_command(arg1
                arg2
                arg3)
>>> print callStringWithIndent('example_command', ['', 'arg2', 'arg3'])
example_command(arg2
                arg3)

Definition at line 101 of file cmt2cmake.py.

00102                                        :
00103     '''
00104     Produce a string for a call of a command with indented arguments.
00105 
00106     >>> print callStringWithIndent('example_command', ['arg1', 'arg2', 'arg3'])
00107     example_command(arg1
00108                     arg2
00109                     arg3)
00110     >>> print callStringWithIndent('example_command', ['', 'arg2', 'arg3'])
00111     example_command(arg2
00112                     arg3)
00113     '''
00114     indent = '\n' + ' ' * (len(cmd) + 1)
00115     return cmd + '(' + indent.join(filter(None, arglines)) + ')'

def cmt2cmake::extName (   n )

Definition at line 85 of file cmt2cmake.py.

00086               :
00087     mapping = {'Reflex': 'ROOT',
00088                'Python': 'PythonLibs'}
00089     return mapping.get(n, n)

def cmt2cmake::isPackage (   path )

Definition at line 90 of file cmt2cmake.py.

00091                    :
00092     return os.path.isfile(os.path.join(path, "cmt", "requirements"))

def cmt2cmake::isProject (   path )

Definition at line 93 of file cmt2cmake.py.

00094                    :
00095     return os.path.isfile(os.path.join(path, "cmt", "project.cmt"))

def cmt2cmake::main (   args = None )

Definition at line 655 of file cmt2cmake.py.

00656                    :
00657     from optparse import OptionParser
00658     parser = OptionParser(usage="%prog [options] [path to project or package]",
00659                           description="Convert CMT-based projects/packages to CMake (Gaudi project)")
00660     parser.add_option("-f", "--force", action="store_true",
00661                       help="overwrite existing files")
00662     parser.add_option('--cache-only', action='store_true',
00663                       help='just update the cache without creating the CMakeLists.txt files.')
00664     #parser.add_option('--cache-file', action='store',
00665     #                  help='file to be used for the cache')
00666 
00667     opts, args = parser.parse_args(args=args)
00668 
00669     logging.basicConfig(level=logging.INFO)
00670 
00671     top_dir = os.getcwd()
00672     if args:
00673         top_dir = args[0]
00674         if not os.path.isdir(top_dir):
00675             parser.error("%s is not a directory" % top_dir)
00676 
00677     if isProject(top_dir):
00678         root = Project(top_dir)
00679     elif isPackage(top_dir):
00680         root = Package(top_dir)
00681         if opts.cache_only:
00682             return # the cache is updated instantiating the package
00683     else:
00684         raise ValueError("%s is neither a project nor a package" % top_dir)
00685 
00686     if opts.cache_only:
00687         root.packages # the cache is updated by instantiating the packages
00688         # note that we can get here only if root is a project
00689     else:
00690         root.process(opts.force)
00691 

def cmt2cmake::makeParser (  )

Definition at line 11 of file cmt2cmake.py.

00012                 :
00013     from pyparsing import ( Word, QuotedString, Keyword, Literal, SkipTo, StringEnd,
00014                             ZeroOrMore, Optional, Combine,
00015                             alphas, alphanums, printables )
00016     dblQuotedString = QuotedString(quoteChar='"', escChar='\\', unquoteResults=False)
00017     sglQuotedString = QuotedString(quoteChar="'", escChar='\\', unquoteResults=False)
00018     value = dblQuotedString | sglQuotedString | Word(printables)
00019 
00020     tag_name = Word(alphas + "_", alphanums + "_-")
00021     tag_expression = Combine(tag_name + ZeroOrMore('&' + tag_name))
00022     values = value + ZeroOrMore(tag_expression + value)
00023 
00024     identifier = Word(alphas + "_", alphanums + "_")
00025     variable = Combine(identifier + '=' + value)
00026 
00027     constituent_option = (Keyword('-no_share')
00028                           | Keyword('-no_static')
00029                           | Keyword('-prototypes')
00030                           | Keyword('-no_prototypes')
00031                           | Keyword('-check')
00032                           | Keyword('-target_tag')
00033                           | Combine('-group=' + value)
00034                           | Combine('-suffix=' + value)
00035                           | Combine('-import=' + value)
00036                           | variable
00037                           | Keyword('-OS9')
00038                           | Keyword('-windows'))
00039     source = (Word(alphanums + "_*./$()")
00040               | Combine('-s=' + value)
00041               | Combine('-k=' + value)
00042               | Combine('-x=' + value))
00043 
00044     # statements
00045     comment = (Literal("#") + SkipTo(StringEnd())).suppress()
00046 
00047     package = Keyword('package') + Word(printables)
00048     version = Keyword("version") + Word(printables)
00049     use = Keyword("use") + identifier + Word(printables) + Optional(identifier) + Optional(Keyword("-no_auto_imports"))
00050 
00051     constituent = ((Keyword('library') | Keyword('application') | Keyword('document'))
00052                    + identifier + ZeroOrMore(constituent_option | source))
00053     macro = (Keyword('macro') | Keyword('macro_append')) + identifier + values
00054 
00055     apply_pattern = Keyword("apply_pattern") + identifier + ZeroOrMore(variable)
00056 
00057 
00058     statement = (package | version | use | constituent | macro | apply_pattern)
00059 
00060     return Optional(statement) + Optional(comment) + StringEnd()

def cmt2cmake::projectCase (   name )

Definition at line 96 of file cmt2cmake.py.

00097                      :
00098     if name.upper() == "DAVINCI":
00099         return "DaVinci"
00100     return name.capitalize()


Variable Documentation

Initial value:
00001 os.environ.get('CMT2CMAKECACHE',
00002                               os.path.join(os.path.dirname(__file__), 'known_subdirs.cache'))

Definition at line 81 of file cmt2cmake.py.

Definition at line 696 of file cmt2cmake.py.

tuple cmt2cmake::CMTParser = makeParser()

Definition at line 61 of file cmt2cmake.py.

tuple cmt2cmake::data_packages = set(['Det/SQLDDDB', 'FieldMap', 'TCK/HltTCK'])

Definition at line 65 of file cmt2cmake.py.

tuple cmt2cmake::idx = all_packs.index('Event/GenEvent')

Definition at line 794 of file cmt2cmake.py.

Definition at line 67 of file cmt2cmake.py.

tuple cmt2cmake::ignored_packages = set(["GaudiSys", "GaudiRelease", "GaudiPolicy"])

Definition at line 64 of file cmt2cmake.py.

tuple cmt2cmake::known_subdirs = shelve.open(_shelve_file)

Definition at line 83 of file cmt2cmake.py.

tuple cmt2cmake::needing_python = ('LoKiCore', 'XMLSummaryKernel', 'CondDBUI')

Definition at line 71 of file cmt2cmake.py.

Initial value:
00001 set(['LHCbMath', 'GenEvent', 'ProcessorKernel', 'TrackKernel',
00002                    'Magnet', 'L0MuonKernel', 'DetDescChecks', 'DetDescSvc',
00003                    'SimComponents', 'DetDescExample', 'CondDBEntityResolver',
00004                    'MuonDAQ', 'STKernel', 'CaloDAQ', 'CaloUtils'])

Definition at line 74 of file cmt2cmake.py.

list cmt2cmake::pack = pr.packages[all_packs[idx]]

Definition at line 805 of file cmt2cmake.py.

tuple cmt2cmake::pr = Project("/home/marco/Devel/LHCb/workspace/LHCb_trunk")

Definition at line 798 of file cmt2cmake.py.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Sep 17 2012 13:49:53 for Gaudi Framework, version v23r4 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004