1#!/usr/bin/python3
2#
3# Copyright (C) 2023 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18import sys
19import os
20
21# Paths for output, relative to system/chre
22CHPP_PARSER_INCLUDE_PATH = 'chpp/include/chpp/common'
23CHPP_PARSER_SOURCE_PATH = 'chpp/common'
24
25LICENSE_HEADER = """/*
26 * Copyright (C) 2020 The Android Open Source Project
27 *
28 * Licensed under the Apache License, Version 2.0 (the "License");
29 * you may not use this file except in compliance with the License.
30 * You may obtain a copy of the License at
31 *
32 *      http://www.apache.org/licenses/LICENSE-2.0
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS,
36 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 * See the License for the specific language governing permissions and
38 * limitations under the License.
39 */
40"""
41
42
43def android_build_top_abs_path():
44    """Gets the absolute path to the Android build top directory or exits the program."""
45
46    android_build_top = os.environ.get('ANDROID_BUILD_TOP')
47    if android_build_top == None or len(android_build_top) == 0:
48        print('ANDROID_BUILD_TOP not found. Please source build/envsetup.sh.')
49        sys.exit(1)
50
51    return android_build_top
52
53
54def system_chre_abs_path():
55    """Gets the absolute path to the system/chre directory or exits this program."""
56
57    return android_build_top_abs_path() + '/system/chre'
58