Initial implementation of blender benchmark addon
Just some glue logic to query progress and results from benchmark. Needed to move files around, so oth standalone and addon are happy.
This commit is contained in:
@@ -23,6 +23,86 @@ class COLORS_ANSI:
|
||||
VERBOSE = False
|
||||
COLORS = COLORS_DUMMY
|
||||
|
||||
class DefaultLoggerProvider:
|
||||
def HEADER(self, *args):
|
||||
print(COLORS.HEADER + COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def WARNING(self, *args):
|
||||
print(COLORS.WARNING + COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def ERROR(self, *args):
|
||||
print(COLORS.FAIL + COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def OK(self, *args):
|
||||
print(COLORS.OKGREEN + COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def BOLD(self, *args):
|
||||
print(COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def INFO(self, *args):
|
||||
print(*args)
|
||||
|
||||
|
||||
def DEBUG(self, *args):
|
||||
# TODO(sergey): Add check that debug is enabled.
|
||||
if False:
|
||||
print(*args)
|
||||
|
||||
|
||||
def FATAL(self, *args):
|
||||
import sys
|
||||
ERROR(*args)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
LOGGER_PROVIDER = DefaultLoggerProvider()
|
||||
|
||||
def HEADER(*args):
|
||||
LOGGER_PROVIDER.HEADER(*args)
|
||||
|
||||
|
||||
def WARNING(*args):
|
||||
LOGGER_PROVIDER.WARNING(*args)
|
||||
|
||||
|
||||
def ERROR(*args):
|
||||
LOGGER_PROVIDER.ERROR(*args)
|
||||
|
||||
|
||||
def OK(*args):
|
||||
LOGGER_PROVIDER.OK(*args)
|
||||
|
||||
|
||||
def BOLD(*args):
|
||||
LOGGER_PROVIDER.BOLD(*args)
|
||||
|
||||
|
||||
def INFO(*args):
|
||||
LOGGER_PROVIDER.INFO(*args)
|
||||
|
||||
|
||||
def DEBUG(*args):
|
||||
LOGGER_PROVIDER.DEBUG(*args)
|
||||
|
||||
|
||||
def FATAL(*args):
|
||||
LOGGER_PROVIDER.FATAL(*args)
|
||||
|
||||
|
||||
def supportsColor():
|
||||
"""
|
||||
@@ -43,53 +123,17 @@ def supportsColor():
|
||||
return True
|
||||
|
||||
|
||||
def HEADER(*args):
|
||||
print(COLORS.HEADER + COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def WARNING(*args):
|
||||
print(COLORS.WARNING + COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def ERROR(*args):
|
||||
print(COLORS.FAIL + COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def OK(*args):
|
||||
print(COLORS.OKGREEN + COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def BOLD(*args):
|
||||
print(COLORS.BOLD, end="")
|
||||
print(*args, end="")
|
||||
print(COLORS.ENDC)
|
||||
|
||||
|
||||
def INFO(*args):
|
||||
print(*args)
|
||||
|
||||
|
||||
def DEBUG(*args):
|
||||
# TODO(sergey): Add check that debug is enabled.
|
||||
if False:
|
||||
print(*args)
|
||||
|
||||
|
||||
def FATAL(*args):
|
||||
import sys
|
||||
ERROR(*args)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def init():
|
||||
if not VERBOSE and supportsColor():
|
||||
global COLORS
|
||||
COLORS = COLORS_ANSI
|
||||
|
||||
|
||||
def setProvider(provider):
|
||||
global LOGGER_PROVIDER
|
||||
LOGGER_PROVIDER = provider
|
||||
|
||||
|
||||
def restoreDefaultProvider():
|
||||
global LOGGER_PROVIDER
|
||||
LOGGER_PROVIDER = DefaultLoggerProvider()
|
||||
|
Reference in New Issue
Block a user