CLI: Make compatible with python3.6
Wrapper generation is still only compatible with python3.7 and above
Change-Id: I33cdc3925cd3fab80c9ce5f4540e1a981a5cc1f0
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
[ROCm/amdsmi commit: adceb8033d]
This commit is contained in:
@@ -9,18 +9,7 @@ set(PY_CLI_INSTALL_DIR
|
||||
"${CMAKE_INSTALL_LIBEXECDIR}" CACHE STRING
|
||||
"CLI tool installation directory")
|
||||
|
||||
# if Python3 is found but the version is below 3.7 - Python3_FOUND is set to FALSE
|
||||
find_package(Python3 3.7 COMPONENTS Interpreter Development)
|
||||
|
||||
# WARN: This is a HACK to pass compile on AMD rhel8 and centos7 CI systems!
|
||||
# Those still use python3.6 which is too old for this project!
|
||||
# TODO: Promote to an error when python3.7 or above is installed on CI
|
||||
if(NOT Python3_FOUND)
|
||||
message(AUTHOR_WARNING "Python3 DOESN'T EXIST OR VERSION IS TOO OLD!: ${Python3_VERSION}")
|
||||
message(AUTHOR_WARNING "The CLI tool will not be created and the project will not be packaged!")
|
||||
# WARN: EXIT CURRENT CMAKE FILE
|
||||
return()
|
||||
endif()
|
||||
find_package(Python3 3.6 COMPONENTS Interpreter Development REQUIRED)
|
||||
|
||||
# hard-linking instead of copying avoids unnecessarry regeneration of packaged files
|
||||
add_custom_command(
|
||||
|
||||
@@ -372,9 +372,18 @@ class AMDSMILogger():
|
||||
|
||||
if self.destination == 'stdout':
|
||||
if watch_output:
|
||||
return
|
||||
# print_output may need another value: flush_output vs watch_output
|
||||
print(human_readable)
|
||||
return
|
||||
# printing as unicode may fail if locale is not set properly
|
||||
# see: https://stackoverflow.com/questions/9942594/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-20
|
||||
# export PYTHONIOENCODING=utf8
|
||||
try:
|
||||
# print as unicode
|
||||
print(human_readable)
|
||||
except UnicodeEncodeError:
|
||||
# print as ascii, ignore incompatible characters
|
||||
print(human_readable.encode('ascii', 'ignore').decode('ascii'))
|
||||
|
||||
else:
|
||||
if watch_output:
|
||||
return
|
||||
|
||||
@@ -56,9 +56,7 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
subparsers = self.add_subparsers(
|
||||
title="AMD-SMI Commands",
|
||||
parser_class=argparse.ArgumentParser,
|
||||
required=True,
|
||||
help="Descriptions:",
|
||||
# dest='cmd',
|
||||
metavar="")
|
||||
|
||||
# Add all subparsers
|
||||
|
||||
Reference in New Issue
Block a user