| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 return map(self._import_for_library, self.libraries) | 238 return map(self._import_for_library, self.libraries) |
| 239 | 239 |
| 240 def _import_for_library(self, library): | 240 def _import_for_library(self, library): |
| 241 """Return the import information for a library in this package.""" | 241 """Return the import information for a library in this package.""" |
| 242 return {'package': self.package.name, 'library': library} | 242 return {'package': self.package.name, 'library': library} |
| 243 | 243 |
| 244 @property | 244 @property |
| 245 def example_version_constraint(self): | 245 def example_version_constraint(self): |
| 246 """Return the example version constraint for this package.""" | 246 """Return the example version constraint for this package.""" |
| 247 if self.version.in_initial_development: | 247 # TODO(nweiz): Once the 1.11 SDK is out and pub supports ">=1.2.3-pre |
| 248 return json.dumps(">=%s <%d.%d.0" % | 248 # <1.2.3", suggest that as the version constraint for prerelease |
| 249 (self.version, self.version.major, self.version.minor + 1)) | 249 # versions. |
| 250 return json.dumps( | 250 return json.dumps("^%s" % self.version) |
| 251 ">=%s <%d.0.0" % (self.version, self.version.major + 1)) | |
| 252 | 251 |
| 253 @property | 252 @property |
| 254 def storage_path(self): | 253 def storage_path(self): |
| 255 """The Cloud Storage path for this package.""" | 254 """The Cloud Storage path for this package.""" |
| 256 # Use the canonical version for the cloud storage path for | 255 # Use the canonical version for the cloud storage path for |
| 257 # backwards-compatibility with package versions that were uploaded | 256 # backwards-compatibility with package versions that were uploaded |
| 258 # prior to storing non-canonicalized versions. | 257 # prior to storing non-canonicalized versions. |
| 259 return 'packages/%s-%s.tar.gz' % \ | 258 return 'packages/%s-%s.tar.gz' % \ |
| 260 (self.package.name, self.version.canonical) | 259 (self.package.name, self.version.canonical) |
| 261 | 260 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 310 |
| 312 if full: | 311 if full: |
| 313 value.update({ | 312 value.update({ |
| 314 'created': self.created.isoformat(), | 313 'created': self.created.isoformat(), |
| 315 'downloads': self.downloads, | 314 'downloads': self.downloads, |
| 316 'libraries': self.libraries, | 315 'libraries': self.libraries, |
| 317 'uploader': self.uploaderEmail | 316 'uploader': self.uploaderEmail |
| 318 }) | 317 }) |
| 319 | 318 |
| 320 return value | 319 return value |
| OLD | NEW |