Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
Improve package version constraint suggestions.
Browse files Browse the repository at this point in the history
Prerelease versions now suggest the stable version as the upper bound,
which provides a compromise between flexibility and potential breakage.
Other versions now use the caret syntax, since most active versions of
pub support it at this point.

Closes #266
See #274

R=kustermann@google.com

Review URL: https://chromiumcodereview.appspot.com//1140493005
  • Loading branch information
nex3 committed May 19, 2015
1 parent a130e60 commit a43ed13
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/models/package_version.py
Expand Up @@ -244,11 +244,10 @@ def _import_for_library(self, library):
@property
def example_version_constraint(self):
"""Return the example version constraint for this package."""
if self.version.in_initial_development:
return json.dumps(">=%s <%d.%d.0" %
(self.version, self.version.major, self.version.minor + 1))
return json.dumps(
">=%s <%d.0.0" % (self.version, self.version.major + 1))
# TODO(nweiz): Once the 1.11 SDK is out and pub supports ">=1.2.3-pre
# <1.2.3", suggest that as the version constraint for prerelease
# versions.
return json.dumps("^%s" % self.version)

@property
def storage_path(self):
Expand Down

0 comments on commit a43ed13

Please sign in to comment.