bdk-blender/scripts/site/sitecustomize.py
Sergey Sharybin 03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00

42 lines
1.7 KiB
Python

# SPDX-License-Identifier: GPL-2.0-or-later
# Make shared libraries needed by modules available in standalone Python binary.
import sys
import os
exe_dir, exe_file = os.path.split(sys.executable)
is_python = exe_file.startswith("python")
# Path to Blender shared libraries.
shared_lib_dirname = "blender.shared" if sys.platform == "win32" else "lib"
if is_python:
shared_lib_dir = os.path.abspath(os.path.join(exe_dir, "..", "..", "..", shared_lib_dirname))
else:
shared_lib_dir = os.path.abspath(os.path.join(exe_dir, shared_lib_dirname))
if sys.platform == "win32":
# Directory for extensions to find DLLs.
if is_python:
os.add_dll_directory(shared_lib_dir)
# Directory for USD extension to find DLLs.
import_paths = os.getenv("PXR_USD_WINDOWS_DLL_PATH")
if import_paths is None:
os.environ["PXR_USD_WINDOWS_DLL_PATH"] = shared_lib_dir
# OIIO will by default add all paths from the path variable to add_dll_directory
# problem there is that those folders will be searched before ours and versions of
# some dlls may be found that are not blenders and may not even be the right version
# causing compatibility issues.
os.environ["OIIO_LOAD_DLLS_FROM_PATH"] = "0"
# MaterialX libraries, append if already specified.
materialx_libs_dir = os.path.abspath(os.path.join(shared_lib_dir, "materialx", "libraries"))
materialx_libs_env = os.getenv("MATERIALX_SEARCH_PATH")
if materialx_libs_env is None:
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir
elif sys.platform == "win32":
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir + ";" + materialx_libs_env
else:
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir + ":" + materialx_libs_env