From 836dee5cf8b4b5a519f29dcd0115c2a7ed731eb8 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 6 Sep 2015 22:37:58 +0200 Subject: [PATCH] [DEBUG] some correction after installing archlinux --- lutin/multiprocess.py | 44 ++----------------- lutin/tools.py | 41 ++++++++++++++++- lutin/z_builder/lutinBuilder_binary.py | 4 +- lutin/z_builder/lutinBuilder_jar.py | 2 +- .../z_builder/lutinBuilder_libraryDynamic.py | 2 +- lutin/z_builder/lutinBuilder_libraryStatic.py | 2 +- 6 files changed, 47 insertions(+), 48 deletions(-) diff --git a/lutin/multiprocess.py b/lutin/multiprocess.py index 7149065..7254141 100644 --- a/lutin/multiprocess.py +++ b/lutin/multiprocess.py @@ -20,7 +20,7 @@ import subprocess import shlex # Local import from . import debug -import tools +from . import tools from . import env queueLock = threading.Lock() @@ -42,44 +42,6 @@ isinit = False # the thread are initialized errorOccured = False # a thread have an error processorAvaillable = 1 # number of CPU core availlable -def store_command(cmd_line, file): - # write cmd line only after to prevent errors ... - if file == "" \ - or file == None: - return; - debug.verbose("create cmd file: " + file) - # Create directory: - tools.create_directory_of_file(file) - # Store the command Line: - file2 = open(file, "w") - file2.write(cmd_line) - file2.flush() - file2.close() - -def store_warning(file, output, err): - # write warning line only after to prevent errors ... - if file == "" \ - or file == None: - return; - if env.get_warning_mode() == False: - debug.verbose("remove warning file: " + file) - # remove file if exist... - tools.remove_file(file); - return; - debug.verbose("create warning file: " + file) - # Create directory: - tools.create_directory_of_file(file) - # Store the command Line: - file2 = open(file, "w") - file2.write("===== output =====\n") - file2.write(output) - file2.write("\n\n") - file2.write("===== error =====\n") - file2.write(err) - file2.write("\n\n") - file2.flush() - file2.close() - ## ## @brief Execute the command and ruturn generate data ## @@ -128,7 +90,7 @@ def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_ output = output.decode("utf-8") err = err.decode("utf-8") # store error if needed: - store_warning(store_output_file, output, err) + tools.store_warning(store_output_file, output, err) # Check error : if p.returncode == 0: debug.debug(env.print_pretty(cmd_line)) @@ -171,7 +133,7 @@ def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_ return debug.verbose("done 3") # write cmd line only after to prevent errors ... - store_command(cmd_line, store_cmd_line) + tools.store_command(cmd_line, store_cmd_line) diff --git a/lutin/tools.py b/lutin/tools.py index d558cf7..202b55e 100644 --- a/lutin/tools.py +++ b/lutin/tools.py @@ -14,7 +14,7 @@ import fnmatch # Local import from . import debug from . import depend -import multiprocess +from . import env """ @@ -106,7 +106,7 @@ def copy_file(src, dst, cmd_file=None, force=False): debug.print_element("copy file", src, "==>", dst) create_directory_of_file(dst) shutil.copyfile(src, dst) - multiprocess.store_command(cmd_line, cmd_file) + store_command(cmd_line, cmd_file) def copy_anything(src, dst): @@ -176,5 +176,42 @@ def move_if_needed(src, dst): file_write_data(dst, src_data) remove_file(src) +def store_command(cmd_line, file): + # write cmd line only after to prevent errors ... + if file == "" \ + or file == None: + return; + debug.verbose("create cmd file: " + file) + # Create directory: + create_directory_of_file(file) + # Store the command Line: + file2 = open(file, "w") + file2.write(cmd_line) + file2.flush() + file2.close() + +def store_warning(file, output, err): + # write warning line only after to prevent errors ... + if file == "" \ + or file == None: + return; + if env.get_warning_mode() == False: + debug.verbose("remove warning file: " + file) + # remove file if exist... + remove_file(file); + return; + debug.verbose("create warning file: " + file) + # Create directory: + create_directory_of_file(file) + # Store the command Line: + file2 = open(file, "w") + file2.write("===== output =====\n") + file2.write(output) + file2.write("\n\n") + file2.write("===== error =====\n") + file2.write(err) + file2.write("\n\n") + file2.flush() + file2.close() diff --git a/lutin/z_builder/lutinBuilder_binary.py b/lutin/z_builder/lutinBuilder_binary.py index 01e32ed..51bf0eb 100644 --- a/lutin/z_builder/lutinBuilder_binary.py +++ b/lutin/z_builder/lutinBuilder_binary.py @@ -104,5 +104,5 @@ def link(file, binary, target, depancy, name, basic_folder): stripSize = tools.file_size(file_dst) debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko") # write cmd line only after to prevent errors ... - multiprocess.store_command(cmdLine, file_cmd) - \ No newline at end of file + tools.store_command(cmdLine, file_cmd) + diff --git a/lutin/z_builder/lutinBuilder_jar.py b/lutin/z_builder/lutinBuilder_jar.py index eeec78d..0b948c4 100644 --- a/lutin/z_builder/lutinBuilder_jar.py +++ b/lutin/z_builder/lutinBuilder_jar.py @@ -65,7 +65,7 @@ def link(file, binary, target, depancy, name, basic_folder): debug.print_element("jar", name, "==>", file_dst) multiprocess.run_command(cmdLine, store_output_file=file_warning) # write cmd line only after to prevent errors ... - multiprocess.store_command(cmdLine, file_cmd) + tools.store_command(cmdLine, file_cmd) #debug.print_element("SharedLib", self.name, "==>", tmpList[1]) return file_dst diff --git a/lutin/z_builder/lutinBuilder_libraryDynamic.py b/lutin/z_builder/lutinBuilder_libraryDynamic.py index 9348292..d9421d6 100644 --- a/lutin/z_builder/lutinBuilder_libraryDynamic.py +++ b/lutin/z_builder/lutinBuilder_libraryDynamic.py @@ -97,6 +97,6 @@ def link(file, binary, target, depancy, name, basic_folder): stripSize = tools.file_size(file_dst) debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko") # write cmd line only after to prevent errors ... - multiprocess.store_command(cmdLine, file_cmd) + tools.store_command(cmdLine, file_cmd) #debug.print_element("SharedLib", self.name, "==>", tmpList[1]) return file_dst diff --git a/lutin/z_builder/lutinBuilder_libraryStatic.py b/lutin/z_builder/lutinBuilder_libraryStatic.py index db7b913..fe6d089 100644 --- a/lutin/z_builder/lutinBuilder_libraryStatic.py +++ b/lutin/z_builder/lutinBuilder_libraryStatic.py @@ -78,5 +78,5 @@ def link(file, binary, target, depancy, name, basic_folder): file_dst ]) multiprocess.run_command(cmdLineRanLib, store_output_file=file_warning) # write cmd line only after to prevent errors ... - multiprocess.store_command(cmdLine, file_cmd) + tools.store_command(cmdLine, file_cmd) return file_dst