|
7 | 7 | import sys |
8 | 8 | import os |
9 | 9 |
|
10 | | -exe_dir, exe_file = os.path.split(sys.executable) |
11 | | -is_python = exe_file.startswith("python") |
12 | | - |
13 | 10 | # Path to Blender shared libraries. |
14 | 11 | shared_lib_dirname = "blender.shared" if sys.platform == "win32" else "lib" |
15 | | -if is_python: |
16 | | - shared_lib_dir = os.path.abspath(os.path.join(exe_dir, "..", "..", "..", shared_lib_dirname)) |
| 12 | + |
| 13 | +if os.path.basename(__file__) == "bpy_site_customize.py": |
| 14 | + # Blender as Python Module. |
| 15 | + is_python = True |
| 16 | + shared_lib_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) |
| 17 | + # On Windows no subdirectory is used. |
| 18 | + if sys.platform != "win32": |
| 19 | + shared_lib_dir = os.path.join(shared_lib_dir, shared_lib_dirname) |
17 | 20 | else: |
18 | | - shared_lib_dir = os.path.abspath(os.path.join(exe_dir, shared_lib_dirname)) |
| 21 | + exe_dir, exe_file = os.path.split(sys.executable) |
| 22 | + is_python = exe_file.startswith("python") |
| 23 | + if is_python: |
| 24 | + # Python executable bundled with Blender. |
| 25 | + shared_lib_dir = os.path.abspath(os.path.join(exe_dir, "..", "..", "..", shared_lib_dirname)) |
| 26 | + else: |
| 27 | + # Blender executable. |
| 28 | + shared_lib_dir = os.path.abspath(os.path.join(exe_dir, shared_lib_dirname)) |
19 | 29 |
|
20 | 30 | if sys.platform == "win32": |
21 | 31 | # Directory for extensions to find DLLs. |
|
0 commit comments