sbsv2/raptor/python/raptor_cli.py
branchfix
changeset 413 5eb26ea9cb49
parent 225 d401dbd3a410
child 498 564986768b79
equal deleted inserted replaced
411:80ad0c7f75fe 413:5eb26ea9cb49
    32 miniCommandOption = "--co"  # update this if another "co" option is added
    32 miniCommandOption = "--co"  # update this if another "co" option is added
    33 
    33 
    34 # raptor_cli module attributes
    34 # raptor_cli module attributes
    35 
    35 
    36 parser = OptionParser(prog = raptor.name,
    36 parser = OptionParser(prog = raptor.name,
    37 					  usage = """%prog [--help] [options] [variable=value] [target] ...
    37 					  usage = """%prog [--help] [options] [target] ...
    38 
    38 
    39 Targets:
    39 Targets:
    40 
    40 
    41 BITMAP         Create bitmap files
    41 BITMAP         Create bitmap files
    42 CLEAN          Remove built files and intermediates, but not exported files
    42 CLEAN          Remove built files and intermediates, but not exported files
   245 	# parse the full set of arguments
   245 	# parse the full set of arguments
   246 	(options, leftover_args) = parser.parse_args(expanded_args)
   246 	(options, leftover_args) = parser.parse_args(expanded_args)
   247 
   247 
   248 	# the leftover_args are either variable assignments of the form a=b
   248 	# the leftover_args are either variable assignments of the form a=b
   249 	# or target names.
   249 	# or target names.
   250 	regex = re.compile("^(.+)=(.*)$")
       
   251 	for leftover in leftover_args:
   250 	for leftover in leftover_args:
   252 		assignment = regex.findall(leftover)
   251 		Raptor.AddTarget(leftover)
   253 		if len(assignment) > 0:
       
   254 			Raptor.SetEnv(assignment[0][0],assignment[0][1])
       
   255 		else:
       
   256 			Raptor.AddTarget(leftover)
       
   257 
   252 
   258 	# Define the dictionary of functions to be used.
   253 	# Define the dictionary of functions to be used.
   259 	# Attributes and function names can be added easily.
   254 	# Attributes and function names can be added easily.
   260 	# The calling attribute should be the same
   255 	# The calling attribute should be the same
   261 	# as specified when creating the add_option
   256 	# as specified when creating the add_option