aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/environment.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2019-11-20 11:43:44 +0100
committerTibor Frank <tifrank@cisco.com>2019-12-03 14:22:39 +0000
commitcbfa26dc0f5334bcd367c161b4eaad342355bbde (patch)
tree0e2c9cec7e956f914dcb8a1b1865ff4e3d7a47fd /resources/tools/presentation/environment.py
parent375aeaab2c14e45ebe45c35947381dc248b32097 (diff)
Python3: PAL
- files renamed: - utils.py --> pal_utils.py - errors.py --> pal_errors.py - functions/methods renamed: - plot_service_density_reconf_box_name --> plot_nf_reconf_box_name - plot_performance_box_name --> plot_perf_box_name - plot_latency_error_bars_name --> plot_lat_err_bars_name - plot_throughput_speedup_analysis_name --> plot_tsa_name - plot_service_density_heatmap --> plot_nf_heatmap - table_performance_comparison --> table_perf_comparison - table_performance_comparison_nic --> table_perf_comparison_nic - table_performance_trending_dashboard_html --> table_perf_trending_dash_html - functions/methods removed: - plot_service_density_heatmap_compare - plot_throughput_speedup_analysis - plot_latency_error_bars - plot_soak_boxes - plot_soak_bars Change-Id: Icddc01d3ccb451abb92b9e5d912b642d01866033 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/environment.py')
-rw-r--r--resources/tools/presentation/environment.py61
1 files changed, 31 insertions, 30 deletions
diff --git a/resources/tools/presentation/environment.py b/resources/tools/presentation/environment.py
index 7cddb0279c..ea4d94ad70 100644
--- a/resources/tools/presentation/environment.py
+++ b/resources/tools/presentation/environment.py
@@ -21,7 +21,7 @@ import os
import shutil
import logging
-from errors import PresentationError
+from pal_errors import PresentationError
class Environment:
@@ -60,34 +60,37 @@ class Environment:
"""
if self._force:
- logging.info("Removing old build(s) ...")
- for directory in self._env["build-dirs"]:
- dir_to_remove = self._env["paths"][directory]
+ logging.info(u"Removing old build(s) ...")
+ for directory in self._env[u"build-dirs"]:
+ dir_to_remove = self._env[u"paths"][directory]
if os.path.isdir(dir_to_remove):
try:
shutil.rmtree(dir_to_remove)
- logging.info(" Removed: {}".format(dir_to_remove))
+ logging.info(f" Removed: {dir_to_remove}")
except OSError:
- raise PresentationError("Cannot remove the directory "
- "'{}'".format(dir_to_remove))
- logging.info("Done.")
+ raise PresentationError(
+ f"Cannot remove the directory {dir_to_remove}"
+ )
+ logging.info(u"Done.")
- logging.info("Making directories ...")
+ logging.info(u"Making directories ...")
- for directory in self._env["make-dirs"]:
- dir_to_make = self._env["paths"][directory]
+ for directory in self._env[u"make-dirs"]:
+ dir_to_make = self._env[u"paths"][directory]
try:
if os.path.isdir(dir_to_make):
- logging.warning("The directory '{}' exists, skipping.".
- format(dir_to_make))
+ logging.warning(
+ f"The directory {dir_to_make} exists, skipping."
+ )
else:
os.makedirs(dir_to_make)
- logging.info(" Created: {}".format(dir_to_make))
+ logging.info(f" Created: {dir_to_make}")
except OSError:
- raise PresentationError("Cannot make the directory '{}'".
- format(dir_to_make))
+ raise PresentationError(
+ f"Cannot make the directory {dir_to_make}"
+ )
- logging.info("Done.")
+ logging.info(u"Done.")
def set_environment(self):
"""Set the environment.
@@ -101,28 +104,26 @@ def clean_environment(env):
:param env: Environment specification.
:type env: dict
- :raises: PresentationError if it is not possible to remove a directory.
"""
- logging.info("Cleaning the environment ...")
+ logging.info(u"Cleaning the environment ...")
- if not env["remove-dirs"]: # None or empty
- logging.info(" No directories to remove.")
+ if not env[u"remove-dirs"]: # None or empty
+ logging.info(u" No directories to remove.")
return
- for directory in env["remove-dirs"]:
- dir_to_remove = env["paths"][directory]
- logging.info(" Removing the working directory {} ...".
- format(dir_to_remove))
+ for directory in env[u"remove-dirs"]:
+ dir_to_remove = env[u"paths"][directory]
+ logging.info(f" Removing the working directory {dir_to_remove} ...")
if os.path.isdir(dir_to_remove):
try:
shutil.rmtree(dir_to_remove)
except OSError as err:
- logging.warning("Cannot remove the directory '{}'".
- format(dir_to_remove))
+ logging.warning(
+ f"Cannot remove the directory {dir_to_remove}"
+ )
logging.debug(str(err))
else:
- logging.warning("The directory '{}' does not exist.".
- format(dir_to_remove))
+ logging.warning(f"The directory {dir_to_remove} does not exist.")
- logging.info("Done.")
+ logging.info(u"Done.")