def do_work(self, args, replacements): print "Creating " + self.name + " template(s) ..." path = helpers.find_path(self.path) if args.args and args.postgres: replacements[ "INCLUDES"] = "import argparse\nimport logging\nimport psycopg2" replacements["ARGPARSE"] = argparsetemplatedb replacements["INITLOGGING"] = initlogging replacements["MAIN"] = maintemplateargsdb if args.args and not args.postgres: replacements["INCLUDES"] = "import argparse\nimport logging" replacements["ARGPARSE"] = argparsetemplate replacements["INITLOGGING"] = initlogging replacements["MAIN"] = maintemplateargs if not args.args: replacements["INCLUDES"] = "" replacements["ARGPARSE"] = "" replacements["INITLOGGING"] = "" replacements["MAIN"] = " pass" if hasattr(args, "filename"): for filename in args.filename: p = path p.append(filename) f = helpers.full_join(p) helpers.add_filename_replacements(replacements, filename) replacements["FILENAME"] = f helpers.default_processing(filename, replacements, template)
def do_work( self , args , replacements ): print "Creating " + self.name + " template(s) ..." path = helpers.find_path( self.path ) if args.args and args.postgres : replacements[ "INCLUDES" ] = "import argparse\nimport logging\nimport psycopg2" replacements[ "ARGPARSE" ] = argparsetemplatedb replacements[ "INITLOGGING" ] = initlogging replacements[ "MAIN" ] = maintemplateargsdb if args.args and not args.postgres : replacements[ "INCLUDES" ] = "import argparse\nimport logging" replacements[ "ARGPARSE" ] = argparsetemplate replacements[ "INITLOGGING" ] = initlogging replacements[ "MAIN" ] = maintemplateargs if not args.args : replacements[ "INCLUDES" ] = "" replacements[ "ARGPARSE" ] = "" replacements[ "INITLOGGING" ] = "" replacements[ "MAIN" ] = " pass" if hasattr( args , "filename" ) : for filename in args.filename: p = path p.append( filename ) f = helpers.full_join( p ) helpers.add_filename_replacements( replacements , filename ) replacements[ "FILENAME" ] = f helpers.default_processing( filename , replacements , template )
def do_work( self , args , replacements ): print "Creating " + self.name + " template(s) ..." path = helpers.find_path( self.path ) replacements[ "LICENSE" ] = self.license replacements[ "PROJECT" ] = args.project[0] replacements[ "TARGETS" ] = "" if ( hasattr( args , "target" ) ) and ( args.target is not None ) and ( len( args.target ) != 0 ) : for target in args.target: print "* Found target " + target p = os.path.splitext( target ) if p[1] == ".cpp" : replacements[ "TARGETS" ] += "add_executable ( " + p[0] + " " + p[0] + ".cpp" + " ) \n" else: replacements[ "TARGETS" ] += "add_executable ( " + target + " " + target + ".cpp" + " ) \n" if hasattr( args , "filename" ) : for filename in args.filename: p = path p.append( filename ) f = helpers.full_join( p ) helpers.add_filename_replacements( replacements , filename ) replacements[ "FILENAME" ] = f helpers.default_processing( filename , replacements , template )
def do_work(self, args, replacements): print "Creating " + self.name + " template(s) ..." path = helpers.find_path(self.path) helpers.add_namespace_replacements(replacements, args, self.namespace) helpers.add_class_replacements(replacements, args, helpers.default_class_template) replacements["LIBNAME"] = self.libname.upper() replacements["LICENSE"] = self.license if hasattr(args, "filename"): for filename in args.filename: filename = helpers.check_filename_ending(filename, "h") p = path p.append(filename) f = helpers.full_join(p) helpers.add_filename_replacements(replacements, filename) replacements["FILENAME"] = f replacements["FILENAMECAP"] = helpers.create_cap_filename_str( f) if self.use_pragma_once: helpers.default_processing(filename, replacements, template_pragma_once) else: helpers.default_processing(filename, replacements, template)
def do_work(self, args, replacements): print "Creating " + self.name + " template(s) ..." path = helpers.find_path(self.path) replacements["LICENSE"] = self.license replacements["TARGET"] = "" replacements["TARGETS"] = "" if (hasattr(args, "target")) and (args.target is not None) and (len(args.target) != 0): for target in args.target: print "* Found target " + target replacements["TARGET"] += (target + " ") replacements["TARGETS"] += (target + " : " + target + ".o" + "\n") if hasattr(args, "filename"): for filename in args.filename: p = path p.append(filename) f = helpers.full_join(p) helpers.add_filename_replacements(replacements, filename) replacements["FILENAME"] = f helpers.default_processing(filename, replacements, template)
def do_work( self , args , replacements ): print "Creating " + self.name + " template(s) ..." path = helpers.find_path( self.path ) replacements[ "INCLUDES" ] = includes replacements[ "MAIN" ] = main if args.postgres : replacements[ "INCLUDES" ] += "import psycopg2" replacements[ "ARGPARSE" ] = argparsetemplatedb replacements[ "MAIN" ] += """\n logging.info( "Connect to db " + args.dbname ) db = psycopg2.connect( host=args.dbhost , port=args.dbport , database=args.dbname , user=args.dbuser , password=args.dbpw )""" if not args.postgres : replacements[ "ARGPARSE" ] = argparsetemplate if hasattr( args , "filename" ) : for filename in args.filename: p = path p.append( filename ) f = helpers.full_join( p ) helpers.add_filename_replacements( replacements , filename ) replacements[ "FILENAME" ] = f helpers.default_processing( filename , replacements , template )
def do_work(self, args, replacements): print "Creating " + self.name + " template(s) ..." path = helpers.find_path(self.path) if hasattr(args, "filename"): for filename in args.filename: filename = helpers.check_filename_ending(filename, "cpp") p = path p.append(filename) replacements["FILENAME"] = helpers.full_join(p) helpers.default_processing(filename, replacements, template)
def do_work( self , args , replacements ): print "Creating " + self.name + " template(s) ..." path = helpers.find_path( self.path ) if hasattr( args , "filename" ) : for filename in args.filename: p = path p.append( filename ) f = helpers.full_join( p ) helpers.add_filename_replacements( replacements , filename ) replacements[ "FILENAME" ] = f helpers.default_processing( filename , replacements , template )
def do_work( self , args , replacements ): print "Creating " + self.name + " template(s) ..." path = helpers.find_path( self.path ) replacements[ "LICENSE" ] = self.license if hasattr( args , "filename" ) : for filename in args.filename: filename = helpers.check_filename_ending( filename , "cpp" ) p = path p.append( filename ) f = helpers.full_join( p ); replacements[ "FILENAME" ] = f helpers.default_processing( filename , replacements , template )
def do_work( self , args , replacements ): print "Creating " + self.name + " template(s) ..." path = helpers.find_path( self.path ) replacements[ "TESTNAME" ] = "dummy" if hasattr( args , "test" ) and ( args.test is not None ) and ( len( args.test ) == 1 ): print "Found test " + args.test[0] replacements[ "TESTNAME" ] = args.test[0] if hasattr( args , "filename" ) : for filename in args.filename: filename = helpers.check_filename_ending( filename , "cpp" ) p = path p.append( filename ) replacements[ "FILENAME" ] = helpers.full_join( p ) helpers.default_processing( filename , replacements , template )
def do_work(self, args, replacements): print "Creating " + self.name + " template(s) ..." path = helpers.find_path(self.path) replacements["TESTNAME"] = "dummy" if hasattr(args, "test") and (args.test is not None) and (len( args.test) == 1): print "Found test " + args.test[0] replacements["TESTNAME"] = args.test[0] if hasattr(args, "filename"): for filename in args.filename: filename = helpers.check_filename_ending(filename, "cpp") p = path p.append(filename) replacements["FILENAME"] = helpers.full_join(p) helpers.default_processing(filename, replacements, template)
def do_work(self, args, replacements): print "Creating " + self.name + " template(s) ..." path = helpers.find_path(self.path) helpers.add_namespace_replacements(replacements, args, self.namespace) helpers.add_class_replacements(replacements, args, helpers.default_class_template) if hasattr(args, "filename"): for filename in args.filename: filename = helpers.check_filename_ending(filename, "h") p = path p.append(filename) f = helpers.full_join(p) helpers.add_filename_replacements(replacements, filename) replacements["FILENAME"] = f replacements["FILENAMECAP"] = helpers.create_cap_filename_str(f) helpers.default_processing(filename, replacements, template)
def do_work( self , args , replacements ): print "Creating " + self.name + " template(s) ..." path = helpers.find_path( self.path ) helpers.add_namespace_replacements( replacements , args , self.namespace ) helpers.add_class_replacements( replacements , args , helpers.default_class_template ) replacements[ "LIBNAME" ] = self.libname.upper() if hasattr( args , "filename" ) : for filename in args.filename: filename = helpers.check_filename_ending( filename , "hpp" ) p = path p.append( filename ) f = helpers.full_join( p ) helpers.add_filename_replacements( replacements , filename ) replacements[ "FILENAME" ] = f ff = f if ff.count( "src" ) != 0: ff = ff[ ff.index( "src" ) + 4 : ] if ff.count( "hpp" ) != 0: ff = ff[ : ff.index( "hpp" ) - 1 ] replacements[ "FILENAMECAP" ] = helpers.create_cap_filename_str( ff ) helpers.default_processing( filename , replacements , template )
def do_work( self , args , replacements ): print "Creating " + self.name + " template(s) ..." path = helpers.find_path( self.path ) replacements[ "LICENSE" ] = self.license replacements[ "TARGET" ] = "" replacements[ "TARGETS" ] = "" if ( hasattr( args , "target" ) ) and ( args.target is not None ) and ( len( args.target ) != 0 ) : for target in args.target: print "* Found target " + target replacements[ "TARGET" ] += ( target + " " ) replacements[ "TARGETS" ] += ( target + " : " + target + ".o" + "\n" ) if hasattr( args , "filename" ) : for filename in args.filename: p = path p.append( filename ) f = helpers.full_join( p ) helpers.add_filename_replacements( replacements , filename ) replacements[ "FILENAME" ] = f helpers.default_processing( filename , replacements , template )