aboutsummaryrefslogtreecommitdiff
path: root/catapult/devil/devil/utils/zip_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'catapult/devil/devil/utils/zip_utils.py')
-rw-r--r--catapult/devil/devil/utils/zip_utils.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/catapult/devil/devil/utils/zip_utils.py b/catapult/devil/devil/utils/zip_utils.py
index e1f812b7..35c59056 100644
--- a/catapult/devil/devil/utils/zip_utils.py
+++ b/catapult/devil/devil/utils/zip_utils.py
@@ -9,18 +9,19 @@ import os
import sys
import zipfile
+_DEVIL_ROOT_DIR = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), '..', '..'))
if __name__ == '__main__':
- _DEVIL_ROOT_DIR = os.path.abspath(
- os.path.join(os.path.dirname(__file__), '..', '..'))
- _PY_UTILS_ROOT_DIR = os.path.abspath(
- os.path.join(_DEVIL_ROOT_DIR, '..', 'common', 'py_utils'))
- sys.path.extend((_DEVIL_ROOT_DIR, _PY_UTILS_ROOT_DIR))
+ sys.path.append(_DEVIL_ROOT_DIR)
+
+_PY_UTILS_ROOT_DIR = os.path.abspath(
+ os.path.join(_DEVIL_ROOT_DIR, '..', 'common', 'py_utils'))
+sys.path.append(_PY_UTILS_ROOT_DIR)
from devil import base_error
from devil.utils import cmd_helper
from py_utils import tempfile_ext
-
logger = logging.getLogger(__name__)
@@ -72,16 +73,16 @@ def WriteZipFile(zip_path, zip_contents):
ZipFailedError on failure.
"""
zip_spec = {
- 'zip_path': zip_path,
- 'zip_contents': zip_contents,
+ 'zip_path': zip_path,
+ 'zip_contents': zip_contents,
}
with tempfile_ext.NamedTemporaryDirectory() as tmpdir:
json_path = os.path.join(tmpdir, 'zip_spec.json')
with open(json_path, 'w') as json_file:
json.dump(zip_spec, json_file)
- ret, output, error = cmd_helper.GetCmdStatusOutputAndError([
- sys.executable, os.path.abspath(__file__),
- '--zip-spec', json_path])
+ ret, output, error = cmd_helper.GetCmdStatusOutputAndError(
+ [sys.executable,
+ os.path.abspath(__file__), '--zip-spec', json_path])
if ret != 0:
exc_msg = ['Failed to create %s' % zip_path]