@@ -54,11 +54,7 @@ def can_cache_bundle(self, descriptor):
54
54
:raises RuntimeError: If six.moves is not available.
55
55
"""
56
56
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 ))
62
58
63
59
def populate_bundle_cache_entry (self , destination , descriptor , ** kwargs ):
64
60
"""
@@ -92,7 +88,7 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
92
88
descd = descriptor .get_dict ()
93
89
version = descriptor .version
94
90
self .logger .info ("Treating %s" % descd )
95
- specs = self ._should_download_release (descd [ "path" ] )
91
+ specs = self ._should_download_release (descd )
96
92
if not specs :
97
93
raise RuntimeError ("Don't know how to download %s" % descd )
98
94
name = specs [0 ]
@@ -142,7 +138,7 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
142
138
for asset in response_d ["assets" ]:
143
139
name = asset ["name" ]
144
140
m = re .match (
145
- "%s-py\d.\d-%s.zip" % (version , pname ),
141
+ r "%s-py\d.\d-%s.zip" % (version , pname ),
146
142
name
147
143
)
148
144
if m :
@@ -171,17 +167,28 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
171
167
self .logger .exception (e )
172
168
raise
173
169
174
- def _should_download_release (self , desc_path ):
170
+ def _should_download_release (self , desc ):
175
171
"""
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
177
173
from a github release.
178
174
179
- :param str desc_path : A Toolkit descriptor path .
175
+ :param str desc : A Toolkit descriptor.
180
176
:returns: A name, token tuple or ``None``.
181
177
"""
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
185
192
return None
186
193
187
194
def _download_zip_github_asset (self , asset , destination , token ):
0 commit comments