def list(self): plans = {} for plan_name in os.listdir(self.base): plan_path = os.path.join(self.base, plan_name) if not os.path.isfile(plan_path): continue plans[plan_name] = parse_inputfile(plan_path, self.cpp_opts) return plans
def update(self, package_names, plan_name): plan_path = os.path.join(self.base, plan_name) current_plan = [] if os.path.exists(plan_path): current_plan = parse_inputfile(plan_path, self.cpp_opts) for package_name in package_names: if not package_name in current_plan: file(plan_path, "a").write(package_name + "\n")
def load_input_file(self): inputfile = tkFileDialog.askopenfilename( parent=self.master, filetypes=[("Input file", "*.input"), ("All files", "*.*")], title="Choose input file to load" ) if inputfile: self.selectinputcombobox.config(state=Tkinter.NORMAL) try: self.sourceselector = adpdeb.SourceSelector( **utils.parse_inputfile(inputfile)) except AssertionError as e: print "[!] Error loading inputfile" print e else: # load list cotent: listcontent = ["{0:d}:{1:s}".format(i + 1, repr(e)) for i, e in enumerate(self.sourceselector.low_res_cat)] # set to first object self.selectinputcombobox['values'] = listcontent self.selectinputcombobox.current(0) self.display_input(0)
force = True elif opt in ('-p', '--pretend'): pretend = True elif opt in ('-n', '--no-deps'): nodeps = True if len(args) == 0: usage() if force and pretend: usage("conflicting options: --force, --pretend") packages = set() for arg in args: if os.path.exists(arg): packages.update(parse_inputfile(arg)) else: packages.add(arg) chanko = Chanko() candidates = chanko.get_package_candidates(packages, nodeps) if len(candidates) == 0: print "Nothing to get..." return bytes = 0 for candidate in candidates: bytes += candidate.bytes print candidate.filename