コード例 #1
0
def getdefstructure(filename):
    platstruct = []
    reip = re.compile(r"IP *:= *")
    reis = re.compile(r"IS *:= *")
    repc = re.compile(r"PROCESSOR *:= *")
    resw = re.compile(r"SW *:= *")
    rewr = re.compile(r"WRAPPER *:= *")
    for lines in open(filename):
        mip = reip.match(lines)
        mis = reis.match(lines)
        mpc = repc.match(lines)
        msw = resw.match(lines)
        mwr = rewr.match(lines)
        if mip:
            for y in lines[mip.end():].split():
                platstruct.append("ip/" + y)
        elif mis:
            for y in lines[mis.end():].split():
                platstruct.append("is/" + y)
        elif msw:
            for y in lines[msw.end():].split():
                platstruct.append("sw/" + y)
        elif mwr:
            for y in lines[mwr.end():].split():
                platstruct.append("wrappers/" + y)
        elif mpc:
            for y in lines[mpc.end():].split():
                platstruct.append("processors/" + y)
        platname = "reserved"
    try:
        platname
    except:
        print ctext(['red'], "!!! Error: platform name not specified.")
        sys.exit(1)
    return platname, platstruct
コード例 #2
0
ファイル: arp_utils.py プロジェクト: ArchC/arp-leon
def getdefstructure(filename):
  platstruct=[]
  reip = re.compile(r"IP *:= *")
  reis = re.compile(r"IS *:= *")
  repc = re.compile(r"PROCESSOR *:= *")
  resw = re.compile(r"SW *:= *")
  rewr = re.compile(r"WRAPPER *:= *")
  for lines in open(filename):
    mip = reip.match(lines)
    mis = reis.match(lines)
    mpc = repc.match(lines)
    msw = resw.match(lines)
    mwr = rewr.match(lines)
    if mip: 
      for y in lines[mip.end():].split(): platstruct.append("ip/"+y)
    elif mis: 
      for y in lines[mis.end():].split(): platstruct.append("is/"+y)
    elif msw: 
      for y in lines[msw.end():].split(): platstruct.append("sw/"+y)
    elif mwr: 
      for y in lines[mwr.end():].split(): platstruct.append("wrappers/"+y)
    elif mpc: 
      for y in lines[mpc.end():].split(): platstruct.append("processors/"+y)
    platname = "reserved"
  try:
    platname
  except:
    print ctext(['red'],"!!! Error: platform name not specified.")
    sys.exit(1)
  return platname, platstruct
コード例 #3
0
ファイル: arp_help.py プロジェクト: ArchC/arp-leon
def shorthelp():
	print
	print ctext(['bold'],"Usage:")
	print "   "+ctext(['turquoise'],"arp")+" [ "+ctext(['green'],"action")+" ] [ "+ctext(['turquoise'],"target")+" ] [ ... ]"
	print
	print ctext(['bold'],"Actions:")+" [ "+ctext(['green'],"--pack")+" | "+ctext(['green'],"--unpack")+" | "+ctext(['green'],"--list")+" ]" 
#  	"+ctext(['green'],"--delete")+" | "+ctext(['green'],"--make")+" | 
# 	"+ctext(['green'],"--test")+" ]"
	print
コード例 #4
0
ファイル: arp_help.py プロジェクト: akunieda/mc723
def shorthelp():
    print
    print ctext(['bold'], "Usage:")
    print "   " + ctext(['turquoise'], "arp") + " [ " + ctext(
        ['green'], "action") + " ] [ " + ctext(['turquoise'],
                                               "target") + " ] [ ... ]"
    print
    print ctext(['bold'], "Actions:") + " [ " + ctext(
        ['green'], "--pack") + " | " + ctext(
            ['green'], "--unpack") + " | " + ctext(['green'], "--list") + " ]"
    #  	"+ctext(['green'],"--delete")+" | "+ctext(['green'],"--make")+" |
    # 	"+ctext(['green'],"--test")+" ]"
    print
コード例 #5
0
ファイル: arp.py プロジェクト: ArchC/arp-leon
	else:
		cmdline.append(x)

# process the options and command arguments
for x in cmdline:
	if not x:
		continue
	if len(x)>=2 and x[0:2]=="--":
		if x in options:
			myopts.append(x)
		elif x[2:] in actions:
			if myaction:
				if myaction not in ["system", "world"]:
					myaction="--"+myaction
				print
				print ctext(['red'],"!!!")+ctext(['green'],\
				" Multiple actions requested... Please choose one only.")
				if myaction != x:
				  print ctext(['red'],"!!!")+" '"+\
				  ctext(['darkgreen'],myaction)+"' "+\
				  ctext(['red'],"or")+" '"+ctext(['darkgreen'],x)+"'"
				print
				sys.exit(1)
			myaction=x[2:]
		else:
			print "!!! Error:",x,"is an invalid option."
			sys.exit(1)
	elif x[-1]=="/":
		# this little conditional helps tab completion
		myfiles.append(x[:-1])
	else:
		myfiles.append(x)
コード例 #6
0
	else:
		cmdline.append(x)

# process the options and command arguments
for x in cmdline:
	if not x:
		continue
	if len(x)>=2 and x[0:2]=="--":
		if x in options:
			myopts.append(x)
		elif x[2:] in actions:
			if myaction:
				if myaction not in ["system", "world"]:
					myaction="--"+myaction
				print
				print ctext(['red'],"!!!")+ctext(['green'],\
				" Multiple actions requested... Please choose one only.")
				if myaction != x:
				  print ctext(['red'],"!!!")+" '"+\
				  ctext(['darkgreen'],myaction)+"' "+\
				  ctext(['red'],"or")+" '"+ctext(['darkgreen'],x)+"'"
				print
				sys.exit(1)
			myaction=x[2:]
		else:
			print "!!! Error:",x,"is an invalid option."
			sys.exit(1)
	elif x[-1]=="/":
		# this little conditional helps tab completion
		myfiles.append(x[:-1])
	else:
		myfiles.append(x)