mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
filter environments before launch
This commit is contained in:
parent
ecf0da7721
commit
391500b2a0
3 changed files with 14 additions and 18 deletions
|
|
@ -29,16 +29,9 @@ def main(input_json_path):
|
|||
data = json.load(stream)
|
||||
|
||||
# Change environment variables
|
||||
# - environments that are in current environments and are not data are
|
||||
# removed
|
||||
if "env" in data:
|
||||
env = data["env"]
|
||||
# Pop environment variable keys that are not in source
|
||||
for key in set(os.environ.keys()) - set(env.keys()):
|
||||
os.environ.pop(key)
|
||||
|
||||
for key, value in env.items():
|
||||
os.environ[key] = value
|
||||
env = data.get("env") or {}
|
||||
for key, value in env.items():
|
||||
os.environ[key] = value
|
||||
|
||||
# Prepare launch arguments
|
||||
args = data["args"]
|
||||
|
|
|
|||
|
|
@ -18,13 +18,7 @@ def add_implementation_envs(env, _app):
|
|||
new_nuke_paths.append(norm_path)
|
||||
|
||||
env["NUKE_PATH"] = os.pathsep.join(new_nuke_paths)
|
||||
# NOTE: Poping of the key is right way. But is commented because there is
|
||||
# a bug in `app_launcher.py` which only change values and not remove
|
||||
# existing.
|
||||
# Fixed with https://github.com/pypeclub/OpenPype/pull/2655
|
||||
# but this fix requires new build
|
||||
# env.pop("QT_AUTO_SCREEN_SCALE_FACTOR", None)
|
||||
env["QT_AUTO_SCREEN_SCALE_FACTOR"] = ""
|
||||
env.pop("QT_AUTO_SCREEN_SCALE_FACTOR", None)
|
||||
|
||||
# Try to add QuickTime to PATH
|
||||
quick_time_path = "C:/Program Files (x86)/QuickTime/QTSystem"
|
||||
|
|
|
|||
|
|
@ -1040,10 +1040,19 @@ class ApplicationLaunchContext:
|
|||
# Prepare data that will be passed to midprocess
|
||||
# - store arguments to a json and pass path to json as last argument
|
||||
# - pass environments to set
|
||||
app_env = self.kwargs.pop("env", {})
|
||||
json_data = {
|
||||
"args": self.launch_args,
|
||||
"env": self.kwargs.pop("env", {})
|
||||
"env": app_env
|
||||
}
|
||||
if app_env:
|
||||
# Filter environments of subprocess
|
||||
self.kwargs["env"] = {
|
||||
key: value
|
||||
for key, value in os.environ.items()
|
||||
if key in app_env
|
||||
}
|
||||
|
||||
# Create temp file
|
||||
json_temp = tempfile.NamedTemporaryFile(
|
||||
mode="w", prefix="op_app_args", suffix=".json", delete=False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue