Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume versions are a pre-release if we cannot parse them #908

Merged
merged 1 commit into from
Apr 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/logic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Pre-release Versions

Starting with v1.4, pip will only install stable versions as specified by `PEP426`_ by default. If
a version cannot be parsed as a compliant `PEP426`_ version then it is assumed
to be stable.
to be a pre-release.

If a Requirement specifier includes a pre-release or development version (e.g. ``>=0.0.dev0``) then
pip will allow pre-release and development versions for that requirement. This does not include
Expand Down
8 changes: 4 additions & 4 deletions pip/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,14 +680,14 @@ def is_prerelease(vers):
"""
Attempt to determine if this is a pre-release using PEP386/PEP426 rules.

Will return True if it is a pre-release, False is not, and None if we cannot
determine.
Will return True if it is a pre-release and False if not. Versions are
assumed to be a pre-release if they cannot be parsed.
"""
normalized = version.suggest_normalized_version(vers)

if normalized is None:
# Cannot normalize
return
# Cannot normalize, assume it is a pre-release
return True

parsed = version.normalized_key(normalized)
return any([any([y in set(["a", "b", "c", "rc", "dev"]) for y in x]) for x in parsed])