This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
Add validator to check correct version of extension for PS and AE #2387
Merged
kalisp
merged 17 commits into
develop
from
feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE
Dec 14, 2021
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
97404ab
OP-2053 - added check of installed extension for PS
kalisp 5dc2fd0
OP-2053 - bump down order of collector for current file
kalisp 2a540cd
Merge branch 'feature/OP-2019_Create-test-publish-class-for-AE' into …
kalisp 2673b58
OP-2053 - added possibility to check installed extension version
kalisp a80ed0d
OP-2053 - Hound
kalisp 148bb47
OP-2053 - allow injection of AVALON_DB env var as a db
kalisp 8739dd9
OP-2053 - fix counts in db_asserts
kalisp 02717fa
Update error msg format
kalisp aa232b4
OP-2053 - fix counts in db_asserts
kalisp b2644d3
Merge remote-tracking branch 'origin/feature/OP-2053_Add-validator-to…
kalisp 621118c
Merge remote-tracking branch 'origin/feature/OP-2053_Add-validator-to…
kalisp 61bf279
Merge branch 'develop' into feature/OP-2053_Add-validator-to-check-co…
kalisp b97d79d
Merge branch 'develop' into feature/OP-2053_Add-validator-to-check-co…
kalisp 1cbcdba
OP-2053 - merge develop
kalisp 0cd9502
Merge remote-tracking branch 'origin/feature/OP-2053_Add-validator-to…
kalisp 450dbf3
OP-2053 - fix PS after merge
kalisp 2c66a1e
OP-2053 - fix PS after merge
kalisp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Close AE after publish. For Webpublishing only.""" | ||
import pyblish.api | ||
|
||
from avalon import aftereffects | ||
|
||
|
||
class CloseAE(pyblish.api.ContextPlugin): | ||
"""Close AE after publish. For Webpublishing only. | ||
""" | ||
|
||
order = pyblish.api.IntegratorOrder + 14 | ||
label = "Close AE" | ||
optional = True | ||
active = True | ||
|
||
hosts = ["aftereffects"] | ||
targets = ["remotepublish"] | ||
|
||
def process(self, context): | ||
self.log.info("CloseAE") | ||
|
||
stub = aftereffects.stub() | ||
self.log.info("Shutting down AE") | ||
stub.save() | ||
stub.close() | ||
self.log.info("AE closed") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
openpype/hosts/aftereffects/plugins/publish/collect_extension_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import os | ||
import re | ||
import pyblish.api | ||
|
||
from avalon import aftereffects | ||
|
||
|
||
class CollectExtensionVersion(pyblish.api.ContextPlugin): | ||
""" Pulls and compares version of installed extension. | ||
|
||
It is recommended to use same extension as in provided Openpype code. | ||
|
||
Please use Anastasiy’s Extension Manager or ZXPInstaller to update | ||
extension in case of an error. | ||
|
||
You can locate extension.zxp in your installed Openpype code in | ||
`repos/avalon-core/avalon/aftereffects` | ||
""" | ||
# This technically should be a validator, but other collectors might be | ||
# impacted with usage of obsolete extension, so collector that runs first | ||
# was chosen | ||
order = pyblish.api.CollectorOrder - 0.5 | ||
label = "Collect extension version" | ||
hosts = ["aftereffects"] | ||
|
||
optional = True | ||
active = True | ||
|
||
def process(self, context): | ||
installed_version = aftereffects.stub().get_extension_version() | ||
|
||
if not installed_version: | ||
raise ValueError("Unknown version, probably old extension") | ||
|
||
manifest_url = os.path.join(os.path.dirname(aftereffects.__file__), | ||
"extension", "CSXS", "manifest.xml") | ||
|
||
if not os.path.exists(manifest_url): | ||
self.log.debug("Unable to locate extension manifest, not checking") | ||
return | ||
|
||
expected_version = None | ||
with open(manifest_url) as fp: | ||
content = fp.read() | ||
found = re.findall(r'(ExtensionBundleVersion=")([0-9\.]+)(")', | ||
content) | ||
if found: | ||
expected_version = found[0][1] | ||
|
||
if expected_version != installed_version: | ||
msg = ( | ||
"Expected version '{}' found '{}'\n Please update" | ||
" your installed extension, it might not work properly." | ||
).format(expected_version, installed_version) | ||
|
||
raise ValueError(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
openpype/hosts/photoshop/plugins/publish/collect_extension_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import os | ||
import re | ||
import pyblish.api | ||
|
||
from avalon import photoshop | ||
|
||
|
||
class CollectExtensionVersion(pyblish.api.ContextPlugin): | ||
""" Pulls and compares version of installed extension. | ||
|
||
It is recommended to use same extension as in provided Openpype code. | ||
|
||
Please use Anastasiy’s Extension Manager or ZXPInstaller to update | ||
extension in case of an error. | ||
|
||
You can locate extension.zxp in your installed Openpype code in | ||
`repos/avalon-core/avalon/photoshop` | ||
""" | ||
# This technically should be a validator, but other collectors might be | ||
# impacted with usage of obsolete extension, so collector that runs first | ||
# was chosen | ||
order = pyblish.api.CollectorOrder - 0.5 | ||
label = "Collect extension version" | ||
hosts = ["photoshop"] | ||
|
||
optional = True | ||
active = True | ||
|
||
def process(self, context): | ||
installed_version = photoshop.stub().get_extension_version() | ||
|
||
if not installed_version: | ||
raise ValueError("Unknown version, probably old extension") | ||
|
||
manifest_url = os.path.join(os.path.dirname(photoshop.__file__), | ||
"extension", "CSXS", "manifest.xml") | ||
|
||
if not os.path.exists(manifest_url): | ||
self.log.debug("Unable to locate extension manifest, not checking") | ||
return | ||
|
||
expected_version = None | ||
with open(manifest_url) as fp: | ||
content = fp.read() | ||
|
||
found = re.findall(r'(ExtensionBundleVersion=")([0-10\.]+)(")', | ||
content) | ||
if found: | ||
expected_version = found[0][1] | ||
|
||
if expected_version != installed_version: | ||
msg = "Expected version '{}' found '{}'\n".format( | ||
expected_version, installed_version) | ||
msg += "Please update your installed extension, it might not work " | ||
msg += "properly." | ||
|
||
raise ValueError(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule avalon-core
updated
from 7e5efd to 85c656
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be in a validator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but "It should be technically validator, but it could miss some failing collectors which would result in non understandable errors."