# ------------------------------------------------------------------------- # tools = list of tool names to import # if -t switch was used, tools = just those files # else scan for *.py files in all dirs in PIZZA_TOOLS list # and then Pizza.py src dir (sys.path[0]) if not silent: print "Loading tools ..." if not silent and nodisplay: print "Display not available ... no GUIs" try: from DEFAULTS import PIZZA_TOOLS except: PIZZA_TOOLS = [] PIZZA_TOOLS = map(os.path.expanduser, PIZZA_TOOLS) PIZZA_TOOLS.append(sys.path[0]) if len(yes_tools) > 0: tools = yes_tools else: tools = [] for dir in PIZZA_TOOLS: tools += glob.glob(dir + "/*.py") for i in range(len(tools)): tools[i] = os.path.basename(tools[i]) tools[i] = tools[i][:-3] # remove duplicate entries, reverse enables removing all but first entry tools.reverse() for tool in tools: while tools.count(tool) > 1:
print "ERROR: cannot use -t and -x switches together" sys.exit() # ------------------------------------------------------------------------- # tools = list of tool names to import # if -t switch was used, tools = just those files # else scan for *.py files in all dirs in PIZZA_TOOLS list # and then Pizza.py src dir (sys.path[0]) if not silent: print "Loading tools ..." if not silent and nodisplay: print "Display not available ... no GUIs" try: from DEFAULTS import PIZZA_TOOLS except: PIZZA_TOOLS = [] PIZZA_TOOLS = map(os.path.expanduser,PIZZA_TOOLS) PIZZA_TOOLS.append(sys.path[0]) if len(yes_tools) > 0: tools = yes_tools else: tools = [] for dir in PIZZA_TOOLS: tools += glob.glob(dir + "/*.py") for i in range(len(tools)): tools[i] = os.path.basename(tools[i]) tools[i] = tools[i][:-3] # remove duplicate entries, reverse enables removing all but first entry tools.reverse() for tool in tools: while tools.count(tool) > 1: tools.remove(tool)