def do_verify_index(self): self.read_yaml_file(var_list.resolve("$(__MAIN_INPUT_FILE__)")) info_map = svnTree.SVNTree() with open_for_read_file_or_url(var_list.resolve("$(INFO_MAP_FILE_URL)")) as rfd: info_map.read_from_text(rfd) # for each iid get full paths to it's sources iid_to_sources = defaultdict(list) InstallItem.begin_get_for_all_oses() for iid in sorted(self.install_definitions_index): with self.install_definitions_index[iid]: for source_var in var_list.get_configVar_obj("iid_source_var_list"): source = var_list.resolve_var_to_list(source_var) if source[2] in ("common", "Mac"): iid_to_sources[iid].append( ("/".join( ("Mac", source[0])), source[1])) if source[2] in ("common", "Win", "Win32", "Win64"): iid_to_sources[iid].append( ("/".join( ("Win", source[0])), source[1])) for iid in sorted(iid_to_sources): with self.install_definitions_index[iid]: iid_problem_messages = list() # check inherits for inheritee in var_list.resolve_var_to_list("iid_inherite"): if inheritee not in self.install_definitions_index: iid_problem_messages.append(" ".join( ("inherits from non existing", inheritee ) )) # check depends for dependee in var_list.resolve_var_to_list("iid_depend_list"): if dependee not in self.install_definitions_index: iid_problem_messages.append(" ".join( ("depends on non existing", dependee ) )) # check sources for source in iid_to_sources[iid]: map_item = info_map.get_item_at_path(source[0]) if map_item is None: iid_problem_messages.append(" ".join( ("source", quoteme_single(source[0]), "does not exist") )) else: if source[1] in ("!dir", "!dir_cont", "!files"): if map_item.isFile(): iid_problem_messages.append(" ".join( ("source", quoteme_single(source[0]), "is a file but type is", source[1]) )) else: file_list, dir_list = map_item.unsorted_sub_items() if source[1] == "!files" and len(file_list) == 0: iid_problem_messages.append(" ".join( ("source", quoteme_single(source[0]), "has no files but type is", source[1]) )) if source[1] in ("!dir", "!dir_cont") and len(file_list)+len(dir_list) == 0: iid_problem_messages.append(" ".join( ("source", quoteme_single(source[0]), "has no files or dirs but type is", source[1]) )) if source[1] == "!file" and not map_item.isFile(): iid_problem_messages.append(" ".join( ("source", quoteme_single(source[0]), "is a dir but type is", source[1]) )) if iid_problem_messages: print(iid+":") for problem_message in sorted(iid_problem_messages): print(" ", problem_message) self.find_cycles() print("index:", len(self.install_definitions_index), "iids") num_files = info_map.num_subs_in_tree(what="file") num_dirs = info_map.num_subs_in_tree(what="dir") print("info map:", num_files, "files in", num_dirs, "folders")
def create_inheritItem_graph(item_map): retVal = nx.DiGraph() for item in item_map: with item_map[item]: for dependant in var_stack.resolve_var_to_list("iid_inherit"): retVal.add_edge(var_stack.resolve_var("iid_iid"), dependant) return retVal
def create_dependencies_graph(item_map): retVal = nx.DiGraph() for item in item_map: with item_map[item]: for dependant in var_list.resolve_var_to_list("iid_depend_list"): retVal.add_edge(var_list.resolve_var("iid_name"), dependant) return retVal
def write_history(self): selected_tab = self.notebook.tab(self.notebook.select(), option='text') var_stack.set_var("SELECTED_TAB").append(selected_tab) the_list_yaml_ready= var_stack.repr_for_yaml(which_vars=var_stack.resolve_var_to_list("__GUI_CONFIG_FILE_VARS__"), include_comments=False, resolve=False, ignore_unknown_vars=True) the_doc_yaml_ready = augmentedYaml.YamlDumpDocWrap(the_list_yaml_ready, '!define', "Definitions", explicit_start=True, sort_mappings=True) with open(var_stack.resolve_var("INSTL_GUI_CONFIG_FILE_NAME"), "w") as wfd: make_open_file_read_write_for_all(wfd) augmentedYaml.writeAsYaml(the_doc_yaml_ready, wfd)
def create_download_instructions(self): self.instlObj.batch_accum.set_current_section('sync') self.instlObj.batch_accum += self.instlObj.platform_helper.progress("Starting sync from $(SYNC_BASE_URL)") self.sync_base_url = var_stack.resolve("$(SYNC_BASE_URL)") self.instlObj.batch_accum += self.instlObj.platform_helper.new_line() for iid in self.installState.full_install_items: with self.install_definitions_index[iid]: for source_var in var_stack.get_configVar_obj("iid_source_var_list"): source = var_stack.resolve_var_to_list(source_var) self.p4_sync_for_source(source)
def needs(self, iid, out_list): """ return all items that depend on iid """ if iid not in self.install_definitions_index: raise KeyError(iid+" is not in index") InstallItem.begin_get_for_all_oses() with self.install_definitions_index[iid]: for dep in var_list.resolve_var_to_list("iid_depend_list"): if dep in self.install_definitions_index: out_list.append(dep) self.needs(dep, out_list) else: out_list.append(dep+"(missing)") InstallItem.reset_get_for_all_oses()
def __sort_install_items_by_target_folder(self, instlObj): for IID in self.full_install_items: with instlObj.install_definitions_index[IID] as installi: folder_list_for_idd = [folder for folder in var_list["iid_folder_list"]] if folder_list_for_idd: for folder in folder_list_for_idd: norm_folder = os.path.normpath(folder) self.install_items_by_target_folder[norm_folder].append(IID) else: # items that need no copy for source_var in var_list.get_configVar_obj("iid_source_var_list"): source = var_list.resolve_var_to_list(source_var) relative_sync_folder = instlObj.relative_sync_folder_for_source(source) sync_folder = os.path.join( "$(LOCAL_REPO_SOURCES_DIR)", relative_sync_folder ) self.no_copy_items_by_sync_folder[sync_folder].append(IID)
def filter_out_unrequired_items(self): """ Removes from work_info_map items not required to be installed. First all items are marked False. Items required by each install source are then marked True. Finally items marked False and empty directories are removed. """ self.work_info_map.set_user_data_all_recursive(False) for iid in self.installState.full_install_items: with self.instlObj.install_definitions_index[iid] as installi: for source_var in var_list.get_configVar_obj("iid_source_var_list"): source = var_list.resolve_var_to_list(source_var) self.mark_required_items_for_source(source) self.work_info_map.recursive_remove_depth_first(is_user_data_false_or_dir_empty) self.work_info_map.write_to_file(var_list.resolve("$(REQUIRED_INFO_MAP_PATH)"), in_format="text")
def create_sync_instructions(self, installState): self.ii.batch_accum.set_current_section('sync') self.ii.batch_accum += self.ii.platform_helper.progress("Starting sync from $(SYNC_BASE_URL)/$(SOURCE_PREFIX)") self.ii.batch_accum += self.ii.platform_helper.mkdir("$(LOCAL_SYNC_DIR)") self.ii.batch_accum += self.ii.platform_helper.cd("$(LOCAL_SYNC_DIR)") self.ii.batch_accum.indent_level += 1 self.ii.batch_accum += " ".join(('"$(SVN_CLIENT_PATH)"', "co", '"$(BOOKKEEPING_DIR_URL)"', '"$(REL_BOOKKIPING_PATH)"', "--revision", "$(REPO_REV)", "--depth", "infinity")) self.ii.batch_accum += self.ii.platform_helper.progress("instl folder file $(BOOKKEEPING_DIR_URL)?p=$(REPO_REV)") for iid in installState.full_install_items: with self.install_definitions_index[iid]: for source_var in var_list.get_configVar_obj("iid_source_var_list"): source = var_list.resolve_var_to_list(source_var) self.ii.batch_accum += self.create_svn_sync_instructions_for_source(source) self.ii.batch_accum += self.ii.platform_helper.progress("Sync {}".format(var_list.resolve("iid_name"))) for iid in installState.orphan_install_items: self.ii.batch_accum += self.ii.platform_helper.echo("Don't know how to sync "+iid) self.ii.batch_accum.indent_level -= 1 self.ii.batch_accum += self.ii.platform_helper.echo("from $(SYNC_BASE_URL)/$(SOURCE_PREFIX)")
def create_admin_command_line(self): command_name = var_stack.resolve_var("ADMIN_GUI_CMD") template_variable = admin_command_template_variables[command_name] retVal = var_stack.resolve_var_to_list(template_variable) # some special handling of command line parameters cannot yet be expressed in the command template if command_name != 'depend': if self.admin_command_name_var.get() in self.commands_that_accept_limit_option: limit_path = self.admin_limit_var.get() if limit_path != "": retVal.append("--limit") limit_paths = shlex.split(limit_path) # there might be space separated paths retVal.extend(limit_paths) if self.run_admin_batch_file_var.get() == 1 and command_name in self.commands_with_run_option_list: retVal.append("--run") if 'Win' in var_stack.resolve_to_list("$(__CURRENT_OS_NAMES__)"): if not getattr(sys, 'frozen', False): retVal.insert(0, sys.executable) return retVal
def init_default_client_vars(self): if "SYNC_BASE_URL" in var_stack: #raise ValueError("'SYNC_BASE_URL' was not defined") resolved_sync_base_url = var_stack.resolve("$(SYNC_BASE_URL)") url_main_item = main_url_item(resolved_sync_base_url) var_stack.set_var("SYNC_BASE_URL_MAIN_ITEM", description="from init_default_client_vars").append(url_main_item) # TARGET_OS_NAMES defaults to __CURRENT_OS_NAMES__, which is not what we want if syncing to # an OS which is not the current if var_stack.resolve("$(TARGET_OS)") != var_stack.resolve("$(__CURRENT_OS__)"): target_os_names = var_stack.resolve_var_to_list(var_stack.resolve("$(TARGET_OS)_ALL_OS_NAMES")) var_stack.set_var("TARGET_OS_NAMES").extend(target_os_names) second_name = var_stack.resolve("$(TARGET_OS)") if len(target_os_names) > 1: second_name = target_os_names[1] var_stack.set_var("TARGET_OS_SECOND_NAME").append(second_name) self.read_repo_type_defaults() if var_stack.resolve("$(REPO_TYPE)") == "P4": if "P4_SYNC_DIR" not in var_stack: if "SYNC_BASE_URL" in var_stack: p4_sync_dir = P4GetPathFromDepotPath(var_stack.resolve("$(SYNC_BASE_URL)")) var_stack.set_var("P4_SYNC_DIR", "from SYNC_BASE_URL").append(p4_sync_dir)
def create_remove_instructions(self): self.have_map = svnTree.SVNTree() have_info_path = var_stack.resolve("$(HAVE_INFO_MAP_PATH)") if not os.path.isfile(have_info_path): have_info_path = var_stack.resolve("$(SITE_HAVE_INFO_MAP_PATH)") self.have_map.read_info_map_from_file(have_info_path, a_format="text") self.batch_accum.set_current_section('remove') self.batch_accum += self.platform_helper.progress("Starting remove") sorted_target_folder_list = sorted(self.installState.install_items_by_target_folder, key=lambda fold: var_stack.resolve(fold), reverse=True) # print(sorted_target_folder_list) self.accumulate_unique_actions('pre_remove', self.installState.full_install_items) for folder_name in sorted_target_folder_list: var_stack.set_var("__TARGET_DIR__").append(os.path.normpath(folder_name)) items_in_folder = self.installState.install_items_by_target_folder[folder_name] logging.info("folder %s", var_stack.resolve(folder_name)) self.batch_accum += self.platform_helper.new_line() self.accumulate_unique_actions('pre_remove_from_folder', items_in_folder) for IID in items_in_folder: with self.install_definitions_index[IID] as installi: for source_var in var_stack.get_configVar_obj("iid_source_var_list"): source = var_stack.resolve_var_to_list(source_var) self.batch_accum += var_stack.resolve_var_to_list_if_exists("iid_action_list_pre_remove_item") self.create_remove_instructions_for_source(folder_name, source) self.batch_accum += var_stack.resolve_var_to_list_if_exists("iid_action_list_post_remove_item") self.batch_accum += self.platform_helper.progress("Remove {installi.name}".format(**locals())) self.accumulate_unique_actions('post_remove_from_folder', items_in_folder) self.accumulate_unique_actions('post_remove', self.installState.full_install_items)
def create_copy_instructions(self): self.have_map = svnTree.SVNTree() # read NEW_HAVE_INFO_MAP_PATH and not HAVE_INFO_MAP_PATH. Copy might be called after the sync batch file was created # but before it was executed. HAVE_INFO_MAP_PATH is only created # when the sync batch file is executed. have_info_path = var_stack.resolve("$(NEW_HAVE_INFO_MAP_PATH)") self.have_map.read_info_map_from_file(have_info_path, a_format="text") # copy and actions instructions for sources self.batch_accum.set_current_section('copy') self.batch_accum += self.platform_helper.progress("Starting copy from $(LOCAL_REPO_SYNC_DIR)") sorted_target_folder_list = sorted(self.installState.install_items_by_target_folder, key=lambda fold: var_stack.resolve(fold)) # first create all target folders so to avoid dependency order problems such as creating links between folders if len(sorted_target_folder_list) > 0: self.batch_accum += self.platform_helper.progress("Creating folders...") for folder_name in sorted_target_folder_list: self.batch_accum += self.platform_helper.mkdir_with_owner(folder_name) self.batch_accum += self.platform_helper.progress("Create folders done") self.accumulate_unique_actions('pre_copy', self.installState.full_install_items) if 'Mac' in var_stack.resolve_to_list("$(__CURRENT_OS_NAMES__)") and 'Mac' in var_stack.resolve_to_list("$(TARGET_OS)"): self.pre_copy_mac_handling() for folder_name in sorted_target_folder_list: items_in_folder = self.installState.install_items_by_target_folder[folder_name] logging.info("folder %s", var_stack.resolve(folder_name)) self.batch_accum += self.platform_helper.new_line() self.batch_accum += self.platform_helper.cd(folder_name) # accumulate pre_copy_to_folder actions from all items, eliminating duplicates self.accumulate_unique_actions('pre_copy_to_folder', items_in_folder) batch_accum_len_before = len(self.batch_accum) self.batch_accum += self.platform_helper.copy_tool.begin_copy_folder() for IID in items_in_folder: with self.install_definitions_index[IID] as installi: for source_var in var_stack.get_configVar_obj("iid_source_var_list"): source = var_stack.resolve_var_to_list(source_var) self.batch_accum += var_stack.resolve_var_to_list_if_exists("iid_action_list_pre_copy_item") self.create_copy_instructions_for_source(source) self.batch_accum += var_stack.resolve_var_to_list_if_exists("iid_action_list_post_copy_item") self.batch_accum += self.platform_helper.progress("Copy {installi.name}".format(**locals())) self.batch_accum += self.platform_helper.copy_tool.end_copy_folder() logging.info("... copy actions: %d", len(self.batch_accum) - batch_accum_len_before) self.batch_accum += self.platform_helper.progress("Expanding files...") self.batch_accum += self.platform_helper.unwtar_current_folder(no_artifacts=True) self.batch_accum += self.platform_helper.progress("Expand files done") if 'Mac' in var_stack.resolve_to_list("$(__CURRENT_OS_NAMES__)") and 'Mac' in var_stack.resolve_to_list("$(TARGET_OS)"): self.batch_accum += self.platform_helper.progress("Resolving symlinks...") self.batch_accum += self.platform_helper.resolve_symlink_files() self.batch_accum += self.platform_helper.progress("Resolve symlinks done") # accumulate post_copy_to_folder actions from all items, eliminating duplicates self.accumulate_unique_actions('post_copy_to_folder', items_in_folder) self.batch_accum.indent_level -= 1 # actions instructions for sources that do not need copying, here folder_name is the sync folder for folder_name, items_in_folder in self.installState.no_copy_items_by_sync_folder.iteritems(): self.batch_accum += self.platform_helper.new_line() self.batch_accum += self.platform_helper.cd(folder_name) self.batch_accum.indent_level += 1 # accumulate pre_copy_to_folder actions from all items, eliminating duplicates self.accumulate_unique_actions('pre_copy_to_folder', items_in_folder) for IID in items_in_folder: with self.install_definitions_index[IID]: for source_var in var_stack.resolve_var_to_list_if_exists("iid_source_var_list"): source = var_stack.resolve_var_to_list(source_var) source_folder, source_name = os.path.split(source[0]) to_untar = os.path.join(folder_name, source_name) self.batch_accum += self.platform_helper.unwtar_something(to_untar) self.batch_accum += var_stack.resolve_var_to_list_if_exists("iid_action_list_pre_copy_item") self.batch_accum += var_stack.resolve_var_to_list_if_exists("iid_action_list_post_copy_item") # accumulate post_copy_to_folder actions from all items, eliminating duplicates self.accumulate_unique_actions('post_copy_to_folder', items_in_folder) self.batch_accum += self.platform_helper.progress("{folder_name}".format(**locals())) self.batch_accum.indent_level -= 1 self.accumulate_unique_actions('post_copy', self.installState.full_install_items) self.batch_accum.set_current_section('post-copy') # Copy have_info file to "site" (e.g. /Library/Application support/... or c:\ProgramData\...) # for reference. But when preparing offline installers the site location is the same as the sync location # so copy should be avoided. if var_stack.resolve("$(HAVE_INFO_MAP_PATH)") != var_stack.resolve("$(SITE_HAVE_INFO_MAP_PATH)"): self.batch_accum += self.platform_helper.mkdir_with_owner("$(SITE_REPO_BOOKKEEPING_DIR)") self.batch_accum += self.platform_helper.copy_file_to_file("$(HAVE_INFO_MAP_PATH)", "$(SITE_HAVE_INFO_MAP_PATH)") self.platform_helper.copy_tool.finalize() self.create_require_file_instructions() # messages about orphan iids for iid in self.installState.orphan_install_items: logging.info("Orphan item: %s", iid) self.batch_accum += self.platform_helper.echo("Don't know how to install " + iid) self.batch_accum += self.platform_helper.progress("Done copy")
def create_copy_instructions(self): # copy and actions instructions for sources self.batch_accum.set_current_section('copy') self.batch_accum += self.platform_helper.progress("Starting copy from $(LOCAL_REPO_SOURCES_DIR)") sorted_target_folder_list = sorted(self.installState.install_items_by_target_folder, key=lambda fold: var_list.resolve(fold)) # first create all target folders so to avoid dependency order problems such as creating links between folders for folder_name in sorted_target_folder_list: self.batch_accum += self.platform_helper.mkdir_with_owner(folder_name) self.batch_accum += self.platform_helper.progress("Make directories done") self.accumulate_unique_actions('copy_in', self.installState.full_install_items) if 'Mac' in var_list.resolve_to_list("$(__CURRENT_OS_NAMES__)") and 'Mac' in var_list.resolve_to_list("$(TARGET_OS)"): self.batch_accum += self.platform_helper.resolve_symlink_files(in_dir="$(LOCAL_REPO_SOURCES_DIR)") self.batch_accum += self.platform_helper.progress("Resolve .symlink files") have_map = svnTree.SVNTree() have_info_path = var_list.resolve("$(NEW_HAVE_INFO_MAP_PATH)") # in case we're in synccopy command if not os.path.isfile(have_info_path): have_info_path = var_list.resolve("$(HAVE_INFO_MAP_PATH)") # in case we're in copy command if os.path.isfile(have_info_path): have_map.read_info_map_from_file(have_info_path, format="text") num_files_to_set_exec = have_map.num_subs_in_tree(what="file", predicate=lambda in_item: in_item.isExecutable()) logging.info("Num files to set exec: %d", num_files_to_set_exec) if num_files_to_set_exec > 0: self.batch_accum += self.platform_helper.pushd("$(LOCAL_REPO_SYNC_DIR)") self.batch_accum += self.platform_helper.set_exec_for_folder(have_info_path) self.platform_helper.num_items_for_progress_report += num_files_to_set_exec self.batch_accum += self.platform_helper.progress("Set exec done") self.batch_accum += self.platform_helper.new_line() self.batch_accum += self.platform_helper.popd() for folder_name in sorted_target_folder_list: items_in_folder = self.installState.install_items_by_target_folder[folder_name] logging.info("folder %s", var_list.resolve(folder_name)) self.batch_accum += self.platform_helper.new_line() self.batch_accum += self.platform_helper.cd(folder_name) # accumulate folder_in actions from all items, eliminating duplicates self.accumulate_unique_actions('folder_in', items_in_folder) batch_accum_len_before = len(self.batch_accum) self.batch_accum += self.platform_helper.copy_tool.begin_copy_folder() for IID in items_in_folder: with self.install_definitions_index[IID] as installi: for source_var in var_list.get_configVar_obj("iid_source_var_list"): source = var_list.resolve_var_to_list(source_var) self.batch_accum += var_list.resolve_to_list("$(iid_action_list_before)") self.create_copy_instructions_for_source(source) self.batch_accum += var_list.resolve_to_list("$(iid_action_list_after)") self.batch_accum += self.platform_helper.progress("Copy {installi.name}".format(**locals())) self.batch_accum += self.platform_helper.copy_tool.end_copy_folder() logging.info("... copy actions: %d", len(self.batch_accum) - batch_accum_len_before) # accumulate folder_out actions from all items, eliminating duplicates self.accumulate_unique_actions('folder_out', items_in_folder) self.batch_accum.indent_level -= 1 # actions instructions for sources that do not need copying, here folder_name is the sync folder for folder_name, items_in_folder in self.installState.no_copy_items_by_sync_folder.iteritems(): # calculate total number of actions for all items relating to folder_name, if 0 we can skip this folder altogether num_actions_for_folder = reduce(lambda x, y: x+len(self.install_definitions_index[y].all_action_list()), items_in_folder, 0) logging.info("%d non-copy items folder %s (%s)", num_actions_for_folder, folder_name, var_list.resolve(folder_name)) if 0 == num_actions_for_folder: continue self.batch_accum += self.platform_helper.new_line() self.batch_accum += self.platform_helper.cd(folder_name) self.batch_accum.indent_level += 1 # accumulate folder_in actions from all items, eliminating duplicates self.accumulate_unique_actions('folder_in', items_in_folder) for IID in items_in_folder: with self.install_definitions_index[IID]: self.batch_accum += var_list.resolve_to_list("$(iid_action_list_before)") self.batch_accum += var_list.resolve_to_list("$(iid_action_list_after)") # accumulate folder_out actions from all items, eliminating duplicates self.accumulate_unique_actions('folder_out', items_in_folder) self.batch_accum += self.platform_helper.progress("{folder_name}".format(**locals())) self.batch_accum.indent_level -= 1 self.accumulate_unique_actions('copy_out', self.installState.full_install_items) self.platform_helper.copy_tool.finalize() # messages about orphan iids for iid in self.installState.orphan_install_items: logging.info("Orphan item: %s", iid) self.batch_accum += self.platform_helper.echo("Don't know how to install "+iid) self.batch_accum += self.platform_helper.progress("Done copy")
def create_admin_frame(self, master): admin_frame = Frame(master) admin_frame.grid(row=0, column=1) curr_row = 0 Label(admin_frame, text="Command:").grid(row=curr_row, column=0, sticky=E) # instl command selection self.admin_command_name_var.set(var_stack.unresolved_var("ADMIN_GUI_CMD")) admin_command_list = var_stack.resolve_var_to_list("__ADMIN_GUI_CMD_LIST__") commandNameMenu = OptionMenu(admin_frame, self.admin_command_name_var, self.admin_command_name_var.get(), *admin_command_list, command=self.update_admin_state) commandNameMenu.grid(row=curr_row, column=1, sticky=W) ToolTip(commandNameMenu, msg="instl admin command") self.run_admin_batch_file_var.set(str_to_bool_int(var_stack.unresolved_var("ADMIN_GUI_RUN_BATCH"))) self.admin_run_batch_file_checkbox = Checkbutton(admin_frame, text="Run batch file", variable=self.run_admin_batch_file_var, command=self.update_admin_state) self.admin_run_batch_file_checkbox.grid(row=curr_row, column=2, columnspan=2, sticky=E) # path to config file curr_row += 1 Label(admin_frame, text="Config file:").grid(row=curr_row, column=0, sticky=E) self.admin_config_path_var.set(var_stack.unresolved_var("ADMIN_GUI_CONFIG_FILE")) configFilePathEntry = Entry(admin_frame, textvariable=self.admin_config_path_var) configFilePathEntry.grid(row=curr_row, column=1, columnspan=2, sticky=W+E) ToolTip(configFilePathEntry, msg="path instl repository config file") self.admin_config_path_var.trace('w', self.update_admin_state) openConfigButt = Button(admin_frame, width=2, text="...", command=self.get_admin_config_file) openConfigButt.grid(row=curr_row, column=3, sticky=W) ToolTip(openConfigButt, msg="open admin config file") editConfigButt = Button(admin_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.resolve_var("ADMIN_GUI_CONFIG_FILE"))) editConfigButt.grid(row=curr_row, column=4, sticky=W) ToolTip(editConfigButt, msg="edit admin config file") checkConfigButt = Button(admin_frame, width=3, text="Chk", command=lambda: self.check_yaml(var_stack.resolve_var("ADMIN_GUI_CONFIG_FILE"))) checkConfigButt.grid(row=curr_row, column=5, sticky=W) ToolTip(checkConfigButt, msg="read admin config file to check it's structure") # path to stage index file curr_row += 1 Label(admin_frame, text="Stage index:").grid(row=curr_row, column=0, sticky=E) Label(admin_frame, text="---", textvariable=self.admin_stage_index_var).grid(row=curr_row, column=1, columnspan=2, sticky=W) editIndexButt = Button(admin_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.resolve("$(__STAGING_INDEX_FILE__)", raise_on_fail=True))) editIndexButt.grid(row=curr_row, column=4, sticky=W) ToolTip(editIndexButt, msg="edit repository index") checkIndexButt = Button(admin_frame, width=3, text="Chk", command=lambda: self.check_yaml(var_stack.resolve("$(__STAGING_INDEX_FILE__)"))) checkIndexButt.grid(row=curr_row, column=5, sticky=W) ToolTip(checkIndexButt, msg="read repository index to check it's structure") # path to svn repository curr_row += 1 Label(admin_frame, text="Svn repo:").grid(row=curr_row, column=0, sticky=E) svnRepoLabel = Label(admin_frame, text="---", textvariable=self.admin_svn_repo_var) svnRepoLabel.grid(row=curr_row, column=1, columnspan=2, sticky=W) ToolTip(svnRepoLabel, msg="URL of the SVN repository with current repo-rev") # sync URL curr_row += 1 Label(admin_frame, text="Sync URL:").grid(row=curr_row, column=0, sticky=E) syncURLLabel = Label(admin_frame, text="---", textvariable=self.admin_sync_url_var) syncURLLabel.grid(row=curr_row, column=1, columnspan=2, sticky=W) ToolTip(syncURLLabel, msg="Top URL for uploading to the repository") # path to output file curr_row += 1 Label(admin_frame, text="Batch file:").grid(row=curr_row, column=0, sticky=E) self.admin_output_path_var.set(var_stack.unresolved_var("ADMIN_GUI_OUT_BATCH_FILE")) Entry(admin_frame, textvariable=self.admin_output_path_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E) self.admin_output_path_var.trace('w', self.update_admin_state) Button(admin_frame, width=2, text="...", command=self.get_admin_output_file).grid(row=curr_row, column=3, sticky=W) Button(admin_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.resolve_var("ADMIN_GUI_OUT_BATCH_FILE"))).grid(row=curr_row, column=4, sticky=W) # relative path to limit folder curr_row += 1 Label(admin_frame, text="Limit to:").grid(row=curr_row, column=0, sticky=E) self.admin_limit_var.set(var_stack.unresolved_var("ADMIN_GUI_LIMIT")) self.limit_path_entry_widget = Entry(admin_frame, textvariable=self.admin_limit_var) self.limit_path_entry_widget.grid(row=curr_row, column=1, columnspan=2, sticky=W+E) self.admin_limit_var.trace('w', self.update_admin_state) # the combined command line text curr_row += 1 Button(admin_frame, width=6, text="run:", command=self.run_admin).grid(row=curr_row, column=0, sticky=W) self.admin_command_line_var = StringVar() Label(admin_frame, textvariable=self.admin_command_line_var, wraplength=400, anchor=W).grid(row=curr_row, column=1, columnspan=2, sticky=W) return admin_frame
def set_default_variables(self): client_command_list = var_stack.resolve_var_to_list("__CLIENT_GUI_CMD_LIST__") var_stack.set_var("CLIENT_GUI_CMD").append(client_command_list[0]) admin_command_list = var_stack.resolve_var_to_list("__ADMIN_GUI_CMD_LIST__") var_stack.set_var("ADMIN_GUI_CMD").append(admin_command_list[0]) self.commands_with_run_option_list = var_stack.resolve_var_to_list("__COMMANDS_WITH_RUN_OPTION__")
def create_client_frame(self, master): client_frame = Frame(master) client_frame.grid(row=0, column=0) curr_row = 0 command_label = Label(client_frame, text="Command:") command_label.grid(row=curr_row, column=0, sticky=W) # instl command selection client_command_list = var_stack.resolve_var_to_list("__CLIENT_GUI_CMD_LIST__") self.client_command_name_var.set(var_stack.unresolved_var("CLIENT_GUI_CMD")) OptionMenu(client_frame, self.client_command_name_var, self.client_command_name_var.get(), *client_command_list, command=self.update_client_state).grid(row=curr_row, column=1, sticky=W) self.run_client_batch_file_var.set(str_to_bool_int(var_stack.unresolved_var("CLIENT_GUI_RUN_BATCH"))) self.client_run_batch_file_checkbox = Checkbutton(client_frame, text="Run batch file", variable=self.run_client_batch_file_var, command=self.update_client_state) self.client_run_batch_file_checkbox.grid(row=curr_row, column=2, sticky=E) # path to input file curr_row += 1 Label(client_frame, text="Input file:").grid(row=curr_row, column=0) self.client_input_path_var.set(var_stack.unresolved_var("CLIENT_GUI_IN_FILE")) self.client_input_combobox = Combobox(client_frame, textvariable=self.client_input_path_var) self.client_input_combobox.grid(row=curr_row, column=1, columnspan=2, sticky=W+E) self.client_input_path_var.trace('w', self.update_client_state) Button(client_frame, width=2, text="...", command=self.get_client_input_file).grid(row=curr_row, column=3, sticky=W) Button(client_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.resolve_var("CLIENT_GUI_IN_FILE"))).grid(row=curr_row, column=4, sticky=W) Button(client_frame, width=3, text="Chk", command=lambda: self.check_yaml(var_stack.resolve_var("CLIENT_GUI_IN_FILE"))).grid(row=curr_row, column=5, sticky=W) # path to output file curr_row += 1 Label(client_frame, text="Batch file:").grid(row=curr_row, column=0) self.client_output_path_var.set(var_stack.unresolved_var("CLIENT_GUI_OUT_FILE")) Entry(client_frame, textvariable=self.client_output_path_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E) self.client_output_path_var.trace('w', self.update_client_state) Button(client_frame, width=2, text="...", command=self.get_client_output_file).grid(row=curr_row, column=3, sticky=W) Button(client_frame, width=4, text="Edit", command=lambda: self.open_file_for_edit(var_stack.resolve_var("CLIENT_GUI_OUT_FILE"))).grid(row=curr_row, column=4, sticky=W) # s3 user credentials curr_row += 1 Label(client_frame, text="Credentials:").grid(row=curr_row, column=0, sticky=E) self.client_credentials_var.set(var_stack.unresolved_var("CLIENT_GUI_CREDENTIALS")) Entry(client_frame, textvariable=self.client_credentials_var).grid(row=curr_row, column=1, columnspan=2, sticky=W+E) self.client_credentials_var.trace('w', self.update_client_state) self.client_credentials_on_var.set(var_stack.unresolved_var("CLIENT_GUI_CREDENTIALS_ON")) Checkbutton(client_frame, text="", variable=self.client_credentials_on_var).grid(row=curr_row, column=3, sticky=W) self.client_credentials_on_var.trace('w', self.update_client_state) # the combined command line text curr_row += 1 Button(client_frame, width=6, text="run:", command=self.run_client).grid(row=curr_row, column=0, sticky=W) self.client_command_line_var = StringVar() Label(client_frame, textvariable=self.client_command_line_var, wraplength=400, anchor=W).grid(row=curr_row, column=1, columnspan=4, sticky=W) client_frame.grid_columnconfigure(0, minsize=80) client_frame.grid_columnconfigure(1, minsize=300) client_frame.grid_columnconfigure(2, minsize=80) return client_frame