Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1776 from pypeclub/feature/python_2_def_where_needed
Browse files Browse the repository at this point in the history
Settings application use python 2 only where needed
  • Loading branch information
iLLiCiTiT authored Jun 29, 2021
2 parents adef63c + cd1bf6d commit 6f2b497
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion openpype/lib/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def __init__(self, name, data, group):
if group.enabled:
enabled = data.get("enabled", True)
self.enabled = enabled
self.use_python_2 = data["use_python_2"]
self.use_python_2 = data.get("use_python_2", False)

self.label = data.get("variant_label") or name
self.full_name = "/".join((group.name, name))
Expand Down
11 changes: 0 additions & 11 deletions openpype/settings/defaults/system_settings/applications.json
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@
"environment": {},
"variants": {
"2-83": {
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\Blender Foundation\\Blender 2.83\\blender.exe"
Expand All @@ -829,7 +828,6 @@
"environment": {}
},
"2-90": {
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\Blender Foundation\\Blender 2.90\\blender.exe"
Expand All @@ -851,7 +849,6 @@
"environment": {}
},
"2-91": {
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\Blender Foundation\\Blender 2.91\\blender.exe"
Expand Down Expand Up @@ -891,7 +888,6 @@
"20": {
"enabled": true,
"variant_label": "20",
"use_python_2": false,
"executables": {
"windows": [],
"darwin": [],
Expand All @@ -907,7 +903,6 @@
"17": {
"enabled": true,
"variant_label": "17",
"use_python_2": false,
"executables": {
"windows": [],
"darwin": [
Expand All @@ -932,7 +927,6 @@
"environment": {},
"variants": {
"animation_11-64bits": {
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\TVPaint Developpement\\TVPaint Animation 11 (64bits)\\TVPaint Animation 11 (64bits).exe"
Expand All @@ -948,7 +942,6 @@
"environment": {}
},
"animation_11-32bits": {
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files (x86)\\TVPaint Developpement\\TVPaint Animation 11 (32bits)\\TVPaint Animation 11 (32bits).exe"
Expand Down Expand Up @@ -982,7 +975,6 @@
"2020": {
"enabled": true,
"variant_label": "2020",
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\Adobe\\Adobe Photoshop 2020\\Photoshop.exe"
Expand All @@ -1000,7 +992,6 @@
"2021": {
"enabled": true,
"variant_label": "2021",
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\Adobe\\Adobe Photoshop 2021\\Photoshop.exe"
Expand Down Expand Up @@ -1030,7 +1021,6 @@
"2020": {
"enabled": true,
"variant_label": "2020",
"use_python_2": false,
"executables": {
"windows": [
""
Expand All @@ -1048,7 +1038,6 @@
"2021": {
"enabled": true,
"variant_label": "2021",
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\Adobe\\Adobe After Effects 2021\\Support Files\\AfterFX.exe"
Expand Down
7 changes: 6 additions & 1 deletion openpype/settings/entities/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def _fill_schema_template_data(
elif isinstance(template, STRING_TYPE):
# TODO find much better way how to handle filling template data
template = template.replace("{{", "__dbcb__").replace("}}", "__decb__")
full_replacement = False
for replacement_string in template_key_pattern.findall(template):
key = str(replacement_string[1:-1])
required_keys.add(key)
Expand All @@ -141,11 +142,15 @@ def _fill_schema_template_data(
# Replace the value with value from templates data
# - with this is possible to set value with different type
template = value
full_replacement = True
else:
# Only replace the key in string
template = template.replace(replacement_string, value)

output = template.replace("__dbcb__", "{").replace("__decb__", "}")
if not full_replacement:
output = template.replace("__dbcb__", "{").replace("__decb__", "}")
else:
output = template

else:
output = template
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
"template_data": [
{
"app_variant_label": "2020",
"app_variant": "2020"
"app_variant": "2020",
"variant_skip_paths": ["use_python_2"]
},
{
"app_variant_label": "2021",
"app_variant": "2021"
"app_variant": "2021",
"variant_skip_paths": ["use_python_2"]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"children": [
{
"type": "schema_template",
"name": "template_host_variant_items"
"name": "template_host_variant_items",
"skip_paths": ["use_python_2"]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
"template_data": [
{
"app_variant_label": "20",
"app_variant": "20"
"app_variant": "20",
"variant_skip_paths": ["use_python_2"]
},
{
"app_variant_label": "17",
"app_variant": "17"
"app_variant": "17",
"variant_skip_paths": ["use_python_2"]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
"template_data": [
{
"app_variant_label": "2020",
"app_variant": "2020"
"app_variant": "2020",
"variant_skip_paths": ["use_python_2"]
},
{
"app_variant_label": "2021",
"app_variant": "2021"
"app_variant": "2021",
"variant_skip_paths": ["use_python_2"]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"children": [
{
"type": "schema_template",
"name": "template_host_variant_items"
"name": "template_host_variant_items",
"skip_paths": ["use_python_2"]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[
{
"__default_values__": {
"variant_skip_paths": null
}
},
{
"type": "dict",
"key": "{app_variant}",
Expand All @@ -19,7 +24,8 @@
},
{
"type": "schema_template",
"name": "template_host_variant_items"
"name": "template_host_variant_items",
"skip_paths": "{variant_skip_paths}"
}
]
}
Expand Down

0 comments on commit 6f2b497

Please sign in to comment.