本文整理汇总了Python中GLIUtility.get_chosts方法的典型用法代码示例。如果您正苦于以下问题:Python GLIUtility.get_chosts方法的具体用法?Python GLIUtility.get_chosts怎么用?Python GLIUtility.get_chosts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLIUtility
的用法示例。
在下文中一共展示了GLIUtility.get_chosts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deactivate
# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import get_chosts [as 别名]
def deactivate(self):
temp_use = ""
sorted_use = self.use_flags.keys()
sorted_use.sort()
for flag in sorted_use:
if self.use_flags[flag]:
temp_use += " " + flag
else:
temp_use += " -" + flag
self.make_conf_values['USE'] = temp_use
self.make_conf_values['CFLAGS'] = "-march=" + self.arch_procs['x86'][self.proc_combo.get_active()] + " " + self.optimizations[self.optimizations_combo.get_active()] + " " + self.custom_cflags_entry.get_text()
if self.unstable_packages_check.get_active():
self.make_conf_values['ACCEPT_KEYWORDS'] = "~x86"
else:
self.make_conf_values['ACCEPT_KEYWORDS'] = ""
temp_features = ""
if self.build_binary_check.get_active():
temp_features += "buildpkg "
if self.use_distcc_check.get_active():
temp_features += "distcc "
if self.use_ccache_check.get_active():
temp_features += "ccache "
self.make_conf_values['FEATURES'] = temp_features.strip()
if self.controller.install_profile.get_install_stage() > 1:
if 'CHOST' in self.make_conf_values:
del self.make_conf_values['CHOST']
else:
self.make_conf_values['CHOST'] = GLIUtility.get_chosts(self.controller.client_profile.get_architecture_template())[self.chost_combo.get_active()]
self.make_conf_values['MAKEOPTS'] = self.makeopts_entry.get_text()
self.etc_files['make.conf'] = self.make_conf_values
self.controller.install_profile.set_etc_files(self.etc_files)
return True
示例2: activate
# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import get_chosts [as 别名]
def activate(self):
self.controller.SHOW_BUTTON_EXIT = True
self.controller.SHOW_BUTTON_HELP = True
self.controller.SHOW_BUTTON_BACK = True
self.controller.SHOW_BUTTON_FORWARD = True
self.controller.SHOW_BUTTON_FINISH = False
self.etc_files = self.controller.install_profile.get_etc_files()
if not "make.conf" in self.etc_files:
self.etc_files['make.conf'] = {}
self.make_conf_values = self.etc_files['make.conf']
# Parsing USE
self.use_flags = {}
if not self.make_conf_values.has_key('USE') or not self.make_conf_values['USE']:
self.make_conf_values['USE'] = self.system_use_flags
for flag in self.make_conf_values['USE'].split(" "):
if flag.startswith("-"):
flag = flag[1:]
self.use_flags[flag] = 0
else:
self.use_flags[flag] = 1
sorted_use = self.use_desc.keys()
sorted_use.sort()
self.treedata = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING)
for flag in sorted_use:
if flag in self.use_flags and self.use_flags[flag] == 1:
self.treedata.append([True, flag, self.use_desc[flag]])
else:
self.treedata.append([False, flag, self.use_desc[flag]])
self.treeview.set_model(self.treedata)
if self.controller.install_profile.get_grp_install():
self.treeview.set_sensitive(False)
self.unstable_packages_check.set_sensitive(False)
self.unstable_packages_check.set_active(False)
else:
self.treeview.set_sensitive(True)
self.unstable_packages_check.set_sensitive(True)
# Parsing CFLAGS
if not self.make_conf_values.has_key('CFLAGS') or not self.make_conf_values['CFLAGS']:
self.make_conf_values['CFLAGS'] = self.system_cflags
custom_cflags = ""
for flag in self.make_conf_values['CFLAGS'].split(" "):
flag = flag.strip()
if flag.startswith("-march="):
equal_pos = flag.find("=")
arch = flag[equal_pos+1:]
i = 0
for proc in self.arch_procs['x86']:
if proc == arch:
self.proc_combo.set_active(i)
break
i += 1
elif flag.startswith("-O"):
i = 0
for opt in self.optimizations:
if flag == opt:
self.optimizations_combo.set_active(i)
break
i += 1
else:
custom_cflags = custom_cflags + " " + flag
self.custom_cflags_entry.set_text(custom_cflags.strip())
# Parsing ACCEPT_KEYWORDS
if not self.make_conf_values.has_key('ACCEPT_KEYWORDS') or not self.make_conf_values['ACCEPT_KEYWORDS']:
self.make_conf_values['ACCEPT_KEYWORDS'] = self.system_accept_keywords
if self.make_conf_values['ACCEPT_KEYWORDS'].find("~x86") != -1:
self.unstable_packages_check.set_active(True)
else:
self.unstable_packages_check.set_active(False)
# Parsing FEATURES
if not self.make_conf_values.has_key('FEATURES') or not self.make_conf_values['FEATURES']:
self.make_conf_values['FEATURES'] = self.system_features
self.use_distcc_check.set_active(False)
self.use_ccache_check.set_active(False)
self.build_binary_check.set_active(False)
for feature in self.make_conf_values['FEATURES'].split(" "):
feature = feature.strip()
if feature == "distcc":
self.use_distcc_check.set_active(True)
elif feature == "ccache":
self.use_ccache_check.set_active(True)
elif feature == "buildpkg":
self.build_binary_check.set_active(True)
# Parsing CHOST
if not self.make_conf_values.has_key('CHOST') or not self.make_conf_values['CHOST']:
self.make_conf_values['CHOST'] = self.system_chost
self.chost_combo.get_model().clear()
for i, chost in enumerate(GLIUtility.get_chosts(self.controller.client_profile.get_architecture_template())):
self.chost_combo.append_text(chost)
if chost == self.make_conf_values['CHOST'] or i == 0:
self.chost_combo.set_active(i)
if self.controller.install_profile.get_install_stage() > 1:
self.chost_combo.set_sensitive(False)
else:
self.chost_combo.set_sensitive(True)
# Parsing MAKEOPTS
if not self.make_conf_values.has_key('MAKEOPTS') or not self.make_conf_values['MAKEOPTS']:
self.make_conf_values['MAKEOPTS'] = self.system_makeopts
self.makeopts_entry.set_text(self.make_conf_values['MAKEOPTS'])