Skip to content

Commit 75e3c30

Browse files
committed
Merge branch 'master' into pubmaster
2 parents 0a86fc2 + e4c2f53 commit 75e3c30

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

hooks/core/bootstrap.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ def can_cache_bundle(self, descriptor):
5454
:raises RuntimeError: If six.moves is not available.
5555
"""
5656
descd = descriptor.get_dict()
57-
# Some descriptors like shotgun descriptors don't have a path: ignore
58-
# them.
59-
if not descd.get("path"):
60-
return False
61-
return bool(self._should_download_release(descd["path"]))
57+
return bool(self._should_download_release(descd))
6258

6359
def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
6460
"""
@@ -92,7 +88,7 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
9288
descd = descriptor.get_dict()
9389
version = descriptor.version
9490
self.logger.info("Treating %s" % descd)
95-
specs = self._should_download_release(descd["path"])
91+
specs = self._should_download_release(descd)
9692
if not specs:
9793
raise RuntimeError("Don't know how to download %s" % descd)
9894
name = specs[0]
@@ -142,7 +138,7 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
142138
for asset in response_d["assets"]:
143139
name = asset["name"]
144140
m = re.match(
145-
r"%s-py\d.\d-%s.zip" % (version, pname),
141+
"%s-py\d.\d-%s.zip" % (version, pname),
146142
name
147143
)
148144
if m:
@@ -171,17 +167,28 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
171167
self.logger.exception(e)
172168
raise
173169

174-
def _should_download_release(self, desc_path):
170+
def _should_download_release(self, desc):
175171
"""
176-
Return a repo name and a token if the given descriptor path should be downloaded
172+
Return a repo name and a token if the given descriptor should be downloaded
177173
from a github release.
178174
179-
:param str desc_path: A Toolkit descriptor path.
175+
:param str desc: A Toolkit descriptor.
180176
:returns: A name, token tuple or ``None``.
181177
"""
182-
for name, token in self._download_release_from_github:
183-
if "[email protected]:%s.git" % name == desc_path:
184-
return name, token
178+
if desc["type"] == "github_release":
179+
# Let's be safe...
180+
if not desc.get("organization") or not desc.get("repository"):
181+
return None
182+
desc_path = "%s/%s" % (desc["organization"], desc["repository"])
183+
for name, token in self._download_release_from_github:
184+
if name == desc_path:
185+
return name, token
186+
elif desc.get("path"):
187+
# Check the path for a git descriptor
188+
desc_path = desc["path"]
189+
for name, token in self._download_release_from_github:
190+
if "[email protected]:%s.git" % name == desc_path:
191+
return name, token
185192
return None
186193

187194
def _download_zip_github_asset(self, asset, destination, token):

hooks/tk-multi-publish2/tk-maya/basic/publish_fbx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def accept(self, settings, item):
157157

158158
# We've validated the publish template. add it to the item properties
159159
# for use in subsequent methods
160-
item.properties["publish_template"] = publish_template
160+
item.local_properties["publish_template"] = publish_template
161161

162162
path = _session_path()
163163
if not path:
@@ -226,7 +226,7 @@ def validate(self, settings, item):
226226
# matches. if not, warn the user and provide a way to save the file to
227227
# a different path
228228
work_template = item.properties.get("work_template")
229-
publish_template = item.properties.get("publish_template")
229+
publish_template = item.local_properties.get("publish_template")
230230
if work_template and publish_template:
231231
# Ensure the fields work for the publish template
232232
# This raises an error if the path does not match the template.
@@ -235,7 +235,7 @@ def validate(self, settings, item):
235235
if missing_keys:
236236
error_msg = (
237237
"Work file '%s' missing keys required for the "
238-
"publish template: %s" % (path, missing_keys)
238+
"publish template %s: %s" % (path, publish_template, missing_keys)
239239
)
240240
self.logger.error(error_msg)
241241
return False

hooks/tk-multi-publish2/tk-maya/basic/publish_turntable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ def accept(self, settings, item):
672672

673673
# We've validated the publish template. add it to the item properties
674674
# for use in subsequent methods
675-
item.properties["publish_template"] = publish_template
675+
item.local_properties["publish_template"] = publish_template
676676

677677
# Because a publish template is configured, disable context change. This
678678
# is a temporary measure until the publisher handles context switching
@@ -721,7 +721,7 @@ def validate(self, settings, item):
721721

722722
# get the configured work file template
723723
work_template = item.properties.get("work_template")
724-
publish_template = item.properties.get("publish_template")
724+
publish_template = item.local_properties.get("publish_template")
725725
if work_template and publish_template:
726726
# get the current scene path and extract fields from it using the work
727727
# template:

0 commit comments

Comments
 (0)