Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Report: Add curr vs prev comp for 3n-snr
[csit.git]
/
resources
/
tools
/
presentation
/
static_content.py
diff --git
a/resources/tools/presentation/static_content.py
b/resources/tools/presentation/static_content.py
index
fe2d072
..
5f234d1
100644
(file)
--- a/
resources/tools/presentation/static_content.py
+++ b/
resources/tools/presentation/static_content.py
@@
-1,4
+1,4
@@
-# Copyright (c) 20
17
Cisco and/or its affiliates.
+# Copyright (c) 20
23
Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@
-22,7
+22,7
@@
from os import makedirs
from os.path import isdir
from shutil import rmtree, copytree, Error
from os.path import isdir
from shutil import rmtree, copytree, Error
-from errors import PresentationError
+from
pal_
errors import PresentationError
def prepare_static_content(spec):
def prepare_static_content(spec):
@@
-31,16
+31,19
@@
def prepare_static_content(spec):
:param spec: Specification read from the specification file.
:type spec: Specification
:raises PresentationError: If it is not possible to process the static
:param spec: Specification read from the specification file.
:type spec: Specification
:raises PresentationError: If it is not possible to process the static
- content.
+
content.
"""
"""
- src = spec.static["src-path"]
- dst = spec.static["dst-path"]
+ src = spec.static.get(u"src-path", None)
+ dst = spec.static.get(u"dst-path", None)
+ if src is None or dst is None:
+ logging.warning(u"No static content specified, skipping")
+ return
# Copy all the static content to the build directory:
# Copy all the static content to the build directory:
- logging.info("Copying the static content ...")
- logging.info(
" Source: {0}".format(src)
)
- logging.info(
" Destination: {0}".format(dst)
)
+ logging.info(
u
"Copying the static content ...")
+ logging.info(
f" Source: {src}"
)
+ logging.info(
f" Destination: {dst}"
)
try:
if isdir(dst):
try:
if isdir(dst):
@@
-48,10
+51,12
@@
def prepare_static_content(spec):
copytree(src, dst)
copytree(src, dst)
- makedirs(spec.environment[
"paths"][
"DIR[WORKING,SRC,STATIC]"])
+ makedirs(spec.environment[
u"paths"][u
"DIR[WORKING,SRC,STATIC]"])
except (Error, OSError) as err:
except (Error, OSError) as err:
- raise PresentationError("Not possible to process the static content.",
- str(err))
+ raise PresentationError(
+ u"Not possible to process the static content.",
+ repr(err)
+ )
- logging.info("Done.")
+ logging.info(
u
"Done.")