OLD | NEW |
1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import copy | 5 import copy |
6 import json | 6 import json |
7 import tarfile | 7 import tarfile |
8 | 8 |
9 from google.appengine.api import memcache | 9 from google.appengine.api import memcache |
10 from google.appengine.ext import db | 10 from google.appengine.ext import db |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 return map(self._import_for_library, self.libraries) | 190 return map(self._import_for_library, self.libraries) |
191 | 191 |
192 def _import_for_library(self, library): | 192 def _import_for_library(self, library): |
193 """Return the import information for a library in this package.""" | 193 """Return the import information for a library in this package.""" |
194 return {'package': self.package.name, 'library': library} | 194 return {'package': self.package.name, 'library': library} |
195 | 195 |
196 @property | 196 @property |
197 def example_version_constraint(self): | 197 def example_version_constraint(self): |
198 """Return the example version constraint for this package.""" | 198 """Return the example version constraint for this package.""" |
199 if self.version.in_initial_development: return str(self.version) | 199 if self.version.in_initial_development: |
| 200 return json.dumps(">=%s <%d.%d.0" % |
| 201 (self.version, self.version.major, self.version.minor + 1)) |
200 return json.dumps( | 202 return json.dumps( |
201 ">=%s <%d.0.0" % (self.version, self.version.major + 1)) | 203 ">=%s <%d.0.0" % (self.version, self.version.major + 1)) |
202 | 204 |
203 @property | 205 @property |
204 def storage_path(self): | 206 def storage_path(self): |
205 """The Cloud Storage path for this package.""" | 207 """The Cloud Storage path for this package.""" |
206 # Use the canonical version for the cloud storage path for | 208 # Use the canonical version for the cloud storage path for |
207 # backwards-compatibility with package versions that were uploaded | 209 # backwards-compatibility with package versions that were uploaded |
208 # prior to storing non-canonicalized versions. | 210 # prior to storing non-canonicalized versions. |
209 return 'packages/%s-%s.tar.gz' % \ | 211 return 'packages/%s-%s.tar.gz' % \ |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 263 |
262 if full: | 264 if full: |
263 value.update({ | 265 value.update({ |
264 'created': self.created.isoformat(), | 266 'created': self.created.isoformat(), |
265 'downloads': self.downloads, | 267 'downloads': self.downloads, |
266 'libraries': self.libraries, | 268 'libraries': self.libraries, |
267 'uploader': self.uploader.email() | 269 'uploader': self.uploader.email() |
268 }) | 270 }) |
269 | 271 |
270 return value | 272 return value |
OLD | NEW |