• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# coding=utf-8
3
4#
5# Copyright (c) 2022 Huawei Device Co., Ltd.
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18from enum import Enum
19
20from ohos.constants import Constant
21from ohos.utils import parse_line_key_value
22
23
24def parse_product_info(line, is_params, product_info):
25    if Constant.PRODUCT_PARAMS_START in line:
26        is_params = True
27    elif Constant.PRODUCT_PARAMS_END in line:
28        is_params = False
29    if is_params:
30        # line output: 2023-11-13 15:51:23.453 OsFullName = xx
31        line = "".join(line.split(" ")[2:])
32        product_info.update(parse_line_key_value(line))
33
34
35class StatusCodes(Enum):
36    FAILURE = -2
37    START = 1
38    ERROR = -1
39    SUCCESS = 0
40    IN_PROGRESS = 2
41    IGNORE = -3
42    BLOCKED = 3
43
44