コード例 #1
0
 def write_copy_debug_info(self):
     try:
         if var_stack.defined('ECHO_LOG_FILE'):
             log_file_path = var_stack.ResolveVarToStr("ECHO_LOG_FILE")
             log_folder, log_file = os.path.split(log_file_path)
             with open(os.path.join(log_folder, "sync-folder-manifest.txt"), "w", encoding='utf-8') as wfd:
                 repo_sync_dir = var_stack.ResolveVarToStr("COPY_SOURCES_ROOT_DIR")
                 wfd.write(utils.folder_listing(repo_sync_dir))
     except Exception:
         pass # if it did not work - forget it
コード例 #2
0
    def do_ls(self):
        if "__MAIN_OUT_FILE__" in var_stack:
            out_file = var_stack.ResolveVarToStr("__MAIN_OUT_FILE__")
        else:
            out_file = "stdout"

        main_folder_to_list = var_stack.ResolveVarToStr("__MAIN_INPUT_FILE__")
        folders_to_list = []
        if var_stack.defined("__LIMIT_COMMAND_TO__"):
            limit_list = var_stack.ResolveVarToList("__LIMIT_COMMAND_TO__")
            for limit in limit_list:
                limit = utils.unquoteme(limit)
                folders_to_list.append(os.path.join(main_folder_to_list, limit))
        else:
            folders_to_list.append(main_folder_to_list)

        the_listing = utils.folder_listing(*folders_to_list)
        with utils.write_to_file_or_stdout(out_file) as wfd:
            wfd.write(the_listing)