def add_description(self, desc, with_sn = None): if hasattr(desc, "__sn__"): raise RuntimeError("The description has a serial number already") if with_sn is None: with_sn = self.next_serial_number() elif with_sn >= self.__next_id: self.__next_id = with_sn + 1 desc.__sn__ = with_sn QProject.add_description(self, desc)
def __init__(self, layouts = [], build_path = None, **kw): # Any description in GUI project has a serial number. self.__next_id = 0 QProject.__init__(self, **kw) self.build_path = build_path self.layouts = {} for l in layouts: # backward compatibility if isinstance(l, tuple): self.add_layout(*l) continue dn = l.desc_name try: l_dict = self.layouts[dn] except KeyError: self.layouts[dn] = l_dict = {} l_dict[l.lid] = l self.history = History()
def main(): p = QProject(descriptions=[ CustomSBDDescription( # This class is defined by `@describable` name="custom_device", directory="misc", mmio_num=1), ]) # We need information about target Qemu source tree. # QDT gets it starting from build directory (where `configure` has work). qemu_build = environ["QEMU_BUILD_DIR"] qemu_version_description = qvd_load_with_cache(qemu_build, version="v4.1.0") # First time the loading may take few minutes because Qemu sources # are analyzed. # Then result is cached in a file to be reused. # Apply Qemu's source code environment. qemu_version_description.use() # And finally, generate the boilerplate. p.gen_all(qemu_src=qemu_version_description.src_path)
def remove_description(self, desc): QProject.remove_description(self, desc) del desc.__sn__
def Q35Project_2_6_0(): return QProject(old_devices() + [Q35MachineNode_2_6_0()])