|
8 | 8 | package_directory = 'onert' |
9 | 9 | packaging_directory = ['build', package_directory + '.egg-info'] |
10 | 10 | THIS_FILE_DIR = os.path.dirname(os.path.abspath(__file__)) |
11 | | -DEFAULT_PRODUCT_DIR = "../../../Product" |
| 11 | +DEFAULT_PRODUCT_DIR = os.path.normpath(os.path.join(THIS_FILE_DIR, "../../../Product")) |
12 | 12 | so_list = [] |
13 | 13 | so_files = [] |
14 | 14 | target_arch = 'none' |
|
51 | 51 | print(f"Created directory '{package_directory}'...") |
52 | 52 |
|
53 | 53 | # copy *py files to package_directory |
54 | | - PY_DIR = os.path.join(THIS_FILE_DIR, '../../../runtime/onert/api/python/package') |
| 54 | + PY_DIR = os.path.normpath( |
| 55 | + os.path.join(THIS_FILE_DIR, '../../../runtime/onert/api/python/package')) |
55 | 56 | for root, dirs, files in os.walk(PY_DIR): |
56 | 57 | # Calculate the relative path from the source directory |
57 | 58 | rel_path = os.path.relpath(root, PY_DIR) |
|
85 | 86 | def get_directories(): |
86 | 87 | # If the environment variable is not set, get default one. |
87 | 88 | product_dir = os.environ.get("PRODUCT_DIR", DEFAULT_PRODUCT_DIR) |
88 | | - return os.path.join(THIS_FILE_DIR, product_dir), os.path.join( |
89 | | - product_dir, |
90 | | - "lib/" if product_dir != DEFAULT_PRODUCT_DIR else target_arch + |
91 | | - '-linux.release/out/lib') |
| 89 | + base_dir = product_dir if product_dir != DEFAULT_PRODUCT_DIR else os.path.join( |
| 90 | + product_dir, target_arch + '-linux.release/out') |
| 91 | + |
| 92 | + if os.path.exists(os.path.join(base_dir, "lib64")): |
| 93 | + return os.path.join(base_dir, "lib64") |
| 94 | + elif os.path.exists(os.path.join(base_dir, "lib32")): |
| 95 | + return os.path.join(base_dir, "lib32") |
| 96 | + elif os.path.exists(os.path.join(base_dir, "lib")): |
| 97 | + return os.path.join(base_dir, "lib") |
| 98 | + else: |
| 99 | + raise FileNotFoundError(f"No lib directory found in {base_dir}") |
92 | 100 |
|
93 | | - product_dir, so_base_dir = get_directories() |
| 101 | + so_base_dir = get_directories() |
| 102 | + print(f"so_base_dir '{so_base_dir}'") |
94 | 103 |
|
95 | 104 | for so in os.listdir(so_base_dir): |
96 | 105 | if so.endswith(".so"): |
|
0 commit comments