Skip to content
Snippets Groups Projects
Commit 0603e38b authored by sguazt's avatar sguazt
Browse files

Fixed an import issue.

parent 52fe2803
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ from easycloud.core.module import Module ...@@ -6,7 +6,7 @@ from easycloud.core.module import Module
import easycloud.modules import easycloud.modules
from easycloud.tui.simpletui import SimpleTUI from easycloud.tui.simpletui import SimpleTUI
import logging import logging
from os import environ, sep from os
from pkgutil import iter_modules from pkgutil import iter_modules
import subprocess import subprocess
import sys import sys
...@@ -69,11 +69,11 @@ class EasyCloud: ...@@ -69,11 +69,11 @@ class EasyCloud:
disclaimer = "\033[34;1mThis is a proof-of-concept build, not suitable\nfor production use.\033[0m\n" disclaimer = "\033[34;1mThis is a proof-of-concept build, not suitable\nfor production use.\033[0m\n"
debug_status = None debug_status = None
hffr_status = None hffr_status = None
if "LIBCLOUD_DEBUG" in environ: if "LIBCLOUD_DEBUG" in os.environ:
debug_status = "\033[93mLibcloud Debug Mode ON\033[0m" debug_status = "\033[93mLibcloud Debug Mode ON\033[0m"
else: else:
debug_status = "\033[90mLibcloud Debug Mode OFF\033[0m" debug_status = "\033[90mLibcloud Debug Mode OFF\033[0m"
if "LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE" in environ and environ["LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE"] == "1": if "LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE" in os.environ and os.environ["LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE"] == "1":
hffr_status = "\033[93mLibcloud Human friendly formatted response ON\033[0m" hffr_status = "\033[93mLibcloud Human friendly formatted response ON\033[0m"
else: else:
hffr_status = "\033[90mLibcloud Human friendly formatted response OFF\033[0m" hffr_status = "\033[90mLibcloud Human friendly formatted response OFF\033[0m"
...@@ -193,7 +193,7 @@ class EasyCloud: ...@@ -193,7 +193,7 @@ class EasyCloud:
else: else:
SimpleTUI.msg_dialog("Library installer", "There was an error while installing the missing packages\n" + SimpleTUI.msg_dialog("Library installer", "There was an error while installing the missing packages\n" +
"for " + module.platform_name + ".\n" "for " + module.platform_name + ".\n"
"Please check " + os.pardir + os.sep + "logs" + sep + "installer.log in the main directory for details.", SimpleTUI.DIALOG_ERROR) "Please check " + os.pardir + os.sep + "logs" + os.sep + "installer.log in the main directory for details.", SimpleTUI.DIALOG_ERROR)
return False return False
return False return False
return True return True
...@@ -211,13 +211,13 @@ class EasyCloud: ...@@ -211,13 +211,13 @@ class EasyCloud:
""" """
subproc = subprocess.Popen([sys.executable, "-m", "pip", "install", "--user"] + pip_libs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) subproc = subprocess.Popen([sys.executable, "-m", "pip", "install", "--user"] + pip_libs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
try: try:
logfile = open(os.pardir + os.sep + "logs" + sep + "libs_installer.log", "a+") # open log in append mode logfile = open(os.pardir + os.sep + "logs" + os.sep + "libs_installer.log", "a+") # open log in append mode
for line in subproc.stdout: for line in subproc.stdout:
# write the subprocess stdout to the log file # write the subprocess stdout to the log file
logfile.write(line.decode(sys.stdout.encoding)) logfile.write(line.decode(sys.stdout.encoding))
logfile.close() logfile.close()
except IOError as e: except IOError as e:
logging.error("IO Error while trying to write data on " + os.pardir + os.sep + "logs" + sep + "libs_installer.log: " + str(e)) logging.error("IO Error while trying to write data on " + os.pardir + os.sep + "logs" + os.sep + "libs_installer.log: " + str(e))
subproc.wait() subproc.wait()
if subproc.returncode: # raise an exception if the installation encountered a problem if subproc.returncode: # raise an exception if the installation encountered a problem
return False return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment