| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 2010

# createProjVersHeader Namespace Reference

## Functions
def | main

## Function Documentation

def createProjVersHeader::main | ( |  | ) |

Definition at line 1 of file createProjVersHeader.py.

    00001           :
    00002     import os, sys, re
    00003     if len(sys.argv) != 4:
    00004         print "ERROR: Usage %s <project> <version> <outputfile>"%sys.argv[0]
    00005         exit(1)
    00006
    00007     project, version, outputfile = sys.argv[1:]
    00008     print "Creating %s for %s %s"%(outputfile, project, version)
    00009
    00010     m = re.match("v([0-9]+)r([0-9]+)(?:p[0-9])?",version)
    00011     majver, minver = [ int(x) for x in m.groups() ]
    00012
    00013     outdir = os.path.dirname(outputfile)
    00014     if not os.path.exists(outdir):
    00015         print "Creating directory", outdir
    00016         os.makedirs(outdir)
    00017
    00018     open(outputfile,"w").write(
    00019     """#ifndef %(proj)s_VERSION
    00020 /* Automatically generated file: do not modify! */
    00021 #ifndef CALC_GAUDI_VERSION
    00022 #define CALC_GAUDI_VERSION(maj,min) (((maj) << 16) + (min))
    00023 #endif
    00024 #define %(proj)s_MAJOR_VERSION %(maj)d
    00025 #define %(proj)s_MINOR_VERSION %(min)d
    00026 #define %(proj)s_VERSION CALC_GAUDI_VERSION(%(proj)s_MAJOR_VERSION,%(proj)s_MINOR_VERSION)
    00027 #endif
    00028 """%{ 'proj': project.upper(), 'min': minver, 'maj': majver })
    00029
    if __name__ == "__main__":