diff --git a/island/__init__.py b/island/__init__.py index a7e053d..cad75de 100755 --- a/island/__init__.py +++ b/island/__init__.py @@ -14,7 +14,7 @@ import copy # Local import from . import host from . import tools -from . import debug +from realog import debug from . import env from . import actions from . import arguments diff --git a/island/actions.py b/island/actions.py index f594522..3886bc6 100644 --- a/island/actions.py +++ b/island/actions.py @@ -9,7 +9,7 @@ ## # Local import -from . import debug +from realog import debug import os import sys from . import env diff --git a/island/actions/islandAction_checkout.py b/island/actions/islandAction_checkout.py index d86eaa4..abcd65d 100644 --- a/island/actions/islandAction_checkout.py +++ b/island/actions/islandAction_checkout.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## -from island import debug +from realog import debug from island import tools from island import env from island import config diff --git a/island/actions/islandAction_command.py b/island/actions/islandAction_command.py index 73ab212..5526164 100644 --- a/island/actions/islandAction_command.py +++ b/island/actions/islandAction_command.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## -from island import debug +from realog import debug from island import tools from island import env from island import multiprocess @@ -46,8 +46,7 @@ def execute(arguments): for elem in all_project: debug.info("------------------------------------------") id_element += 1 - debug.verbose("execute command : " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) - debug.info("in: " + str(elem.name)) + debug.info("execute command : " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) #debug.debug("elem : " + str(elem)) git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: @@ -57,7 +56,8 @@ def execute(arguments): debug.verbose("execute : " + cmd) ret = multiprocess.run_command(cmd, cwd=git_repo_path) if ret[0] == 0: - debug.info(ret[1]) + debug.info("ret=" + ret[1]) + debug.info("err=" + ret[2]) else: debug.info("Execution ERROR") \ No newline at end of file diff --git a/island/actions/islandAction_commit.py b/island/actions/islandAction_commit.py index 117f4a2..4a222f0 100644 --- a/island/actions/islandAction_commit.py +++ b/island/actions/islandAction_commit.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## -from island import debug +from realog import debug from island import tools from island import env from island import config diff --git a/island/actions/islandAction_fetch.py b/island/actions/islandAction_fetch.py index ab52401..b73e556 100644 --- a/island/actions/islandAction_fetch.py +++ b/island/actions/islandAction_fetch.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## -from island import debug +from realog import debug from island import tools from island import env from island import config diff --git a/island/actions/islandAction_init.py b/island/actions/islandAction_init.py index e3f1235..1f840fc 100644 --- a/island/actions/islandAction_init.py +++ b/island/actions/islandAction_init.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## -from island import debug +from realog import debug from island import tools from island import env from island import config diff --git a/island/actions/islandAction_push.py b/island/actions/islandAction_push.py index b9c250f..0301589 100644 --- a/island/actions/islandAction_push.py +++ b/island/actions/islandAction_push.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## -from island import debug +from realog import debug from island import tools from island import env from island import config diff --git a/island/actions/islandAction_status.py b/island/actions/islandAction_status.py index a3ca665..072d2de 100644 --- a/island/actions/islandAction_status.py +++ b/island/actions/islandAction_status.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## -from island import debug +from realog import debug from island import tools from island import env from island import multiprocess diff --git a/island/actions/islandAction_sync.py b/island/actions/islandAction_sync.py index 113498e..9f2d081 100644 --- a/island/actions/islandAction_sync.py +++ b/island/actions/islandAction_sync.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## -from island import debug +from realog import debug from island import tools from island import env from island import config diff --git a/island/arguments.py b/island/arguments.py index ebb8027..1385764 100644 --- a/island/arguments.py +++ b/island/arguments.py @@ -8,7 +8,7 @@ ## @license MPL v2.0 (see license file) ## import sys -from . import debug +from realog import debug ## ## @brief Single argument class. It permit to define the getted argument. diff --git a/island/config.py b/island/config.py index 894c8cd..1718d59 100644 --- a/island/config.py +++ b/island/config.py @@ -12,7 +12,7 @@ import sys import os import copy # Local import -from . import debug +from realog import debug from . import tools from . import env from . import multiprocess diff --git a/island/debug.py b/island/debug.py deleted file mode 100644 index 0a2e09e..0000000 --- a/island/debug.py +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -## -## @author Edouard DUPIN -## -## @copyright 2012, Edouard DUPIN, all right reserved -## -## @license MPL v2.0 (see license file) -## - -import os -import threading -import re - -debug_level=3 -debug_color=False - -color_default= "" -color_red = "" -color_green = "" -color_yellow = "" -color_blue = "" -color_purple = "" -color_cyan = "" - - -debug_lock = threading.Lock() - -## -## @brief Set log level of the console log system -## @param[in] id (int) Value of the log level: -## 0: None -## 1: error -## 2: warning -## 3: info -## 4: debug -## 5: verbose -## 6: extreme_verbose -## -def set_level(id): - global debug_level - debug_level = id - #print "SetDebug level at " + str(debug_level) - -## -## @brief Get the current debug leval -## @return The value of the log level. Show: @ref set_level -## -def get_level(): - global debug_level - return debug_level - -## -## @brief Enable color of the console Log system -## -def enable_color(): - global debug_color - debug_color = True - global color_default - color_default= "\033[00m" - global color_red - color_red = "\033[31m" - global color_green - color_green = "\033[32m" - global color_yellow - color_yellow = "\033[33m" - global color_blue - color_blue = "\033[01;34m" - global color_purple - color_purple = "\033[35m" - global color_cyan - color_cyan = "\033[36m" - -## -## @brief Disable color of the console Log system -## -def disable_color(): - global debug_color - debug_color = True - global color_default - color_default= "" - global color_red - color_red = "" - global color_green - color_green = "" - global color_yellow - color_yellow = "" - global color_blue - color_blue = "" - global color_purple - color_purple = "" - global color_cyan - color_cyan = "" - -## -## @brief Print a extreme verbose log -## @param[in] input (string) Value to print if level is enough -## @param[in] force (bool) force display (no check of log level) -## -def extreme_verbose(input, force=False): - global debug_lock - global debug_level - if debug_level >= 6 \ - or force == True: - debug_lock.acquire() - print(color_blue + input + color_default) - debug_lock.release() - -## -## @brief Print a verbose log -## @param[in] input (string) Value to print if level is enough -## @param[in] force (bool) force display (no check of log level) -## -def verbose(input, force=False): - global debug_lock - global debug_level - if debug_level >= 5 \ - or force == True: - debug_lock.acquire() - print(color_blue + input + color_default) - debug_lock.release() - -## -## @brief Print a debug log -## @param[in] input (string) Value to print if level is enough -## @param[in] force (bool) force display (no check of log level) -## -def debug(input, force=False): - global debug_lock - global debug_level - if debug_level >= 4 \ - or force == True: - debug_lock.acquire() - print(color_green + input + color_default) - debug_lock.release() - -## -## @brief Print an info log -## @param[in] input (string) Value to print if level is enough -## @param[in] force (bool) force display (no check of log level) -## -def info(input, force=False): - global debug_lock - global debug_level - if debug_level >= 3 \ - or force == True: - debug_lock.acquire() - print(input + color_default) - debug_lock.release() - -## -## @brief Print a warning log -## @param[in] input (string) Value to print if level is enough -## @param[in] force (bool) force display (no check of log level) -## -def warning(input, force=False): - global debug_lock - global debug_level - if debug_level >= 2 \ - or force == True: - debug_lock.acquire() - print(color_purple + "[WARNING] " + input + color_default) - debug_lock.release() - -## -## @brief Print a todo log -## @param[in] input (string) Value to print if level is enough -## @param[in] force (bool) force display (no check of log level) -## -def todo(input, force=False): - global debug_lock - global debug_level - if debug_level >= 3 \ - or force == True: - debug_lock.acquire() - print(color_purple + "[TODO] " + input + color_default) - debug_lock.release() - -## -## @brief Print an error log -## @param[in] input (string) Value to print if level is enough -## @param[in] thread_id (int) Current thead ID of the builder thread -## @param[in] force (bool) force display (no check of log level) -## @param[in] crash (bool) build error has appear ==> request stop of all builds -## -def error(input, thread_id=-1, force=False, crash=True): - global debug_lock - global debug_level - if debug_level >= 1 \ - or force == True: - debug_lock.acquire() - print(color_red + "[ERROR] " + input + color_default) - debug_lock.release() - if crash == True: - exit(-1) - #os_exit(-1) - #raise "error happend" - - -## -## @brief Print a log for a specific element action like generateing .so or binary ... -## @param[in] type (string) type of action. Like: "copy file", "StaticLib", "Prebuild", "Library" ... -## @param[in] lib (string) Name of the library/binary/package that action is done -## @param[in] dir (string) build direction. ex: "<==", "==>" ... -## @param[in] name (string) Destination of the data -## @param[in] force (bool) force display (no check of log level) -## -def print_element(type, lib, dir, name, force=False): - global debug_lock - global debug_level - if debug_level >= 3 \ - or force == True: - debug_lock.acquire() - print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default) - debug_lock.release() - -## -## @brief Print a compilation return (output) -## @param[in] my_string (string) Std-error/std-info that is generate by the build system -## -def print_compilator(my_string): - global debug_color - global debug_lock - if debug_color == True: - my_string = my_string.replace('\\n', '\n') - my_string = my_string.replace('\\t', '\t') - my_string = my_string.replace('error:', color_red+'error:'+color_default) - my_string = my_string.replace('warning:', color_purple+'warning:'+color_default) - my_string = my_string.replace('note:', color_green+'note:'+color_default) - my_string = re.sub(r'([/\w_-]+\.\w+):', r'-COLORIN-\1-COLOROUT-:', my_string) - my_string = my_string.replace('-COLORIN-', color_yellow) - my_string = my_string.replace('-COLOROUT-', color_default) - - debug_lock.acquire() - print(my_string) - debug_lock.release() - -## -## @brief Get the list of default color -## @return A map with keys: "default","red","green","yellow","blue","purple","cyan" -## -def get_color_set() : - global color_default - global color_red - global color_green - global color_yellow - global color_blue - global color_purple - global color_cyan - return { - "default": color_default, - "red": color_red, - "green": color_green, - "yellow": color_yellow, - "blue": color_blue, - "purple": color_purple, - "cyan": color_cyan, - } diff --git a/island/env.py b/island/env.py index 3d8def3..a77d427 100644 --- a/island/env.py +++ b/island/env.py @@ -9,7 +9,7 @@ ## # Local import -from . import debug +from realog import debug import os diff --git a/island/host.py b/island/host.py index 9bb97d1..9c3099b 100644 --- a/island/host.py +++ b/island/host.py @@ -10,7 +10,7 @@ import platform import sys # Local import -from . import debug +from realog import debug # print os.name # ==> 'posix' if platform.system() == "Linux": diff --git a/island/manifest.py b/island/manifest.py index 985a113..4d52e31 100644 --- a/island/manifest.py +++ b/island/manifest.py @@ -12,7 +12,7 @@ import sys import os import copy # Local import -from . import debug +from realog import debug from . import tools from . import env from . import multiprocess diff --git a/island/multiprocess.py b/island/multiprocess.py index 3f21d0b..aea52d2 100644 --- a/island/multiprocess.py +++ b/island/multiprocess.py @@ -16,7 +16,7 @@ import os import subprocess import shlex # Local import -from . import debug +from realog import debug from . import tools from . import env diff --git a/island/tools.py b/island/tools.py index 2eb3962..6f69b6f 100644 --- a/island/tools.py +++ b/island/tools.py @@ -14,7 +14,7 @@ import errno import fnmatch import stat # Local import -from . import debug +from realog import debug from . import env """ diff --git a/setup.py b/setup.py index 2255f80..c8e7d4b 100755 --- a/setup.py +++ b/setup.py @@ -39,6 +39,7 @@ setup(name='island', #], install_requires=[ 'lxml', + 'realog', ], include_package_data = True, zip_safe=False)